Ad
  • Custom User Avatar
  • Custom User Avatar

    Good kata, just a few bugs to fix:

    • Instructions state the result string should be Player[i] wins!. The sample unit tests check for this format: Playeri wins!. The actual unit tests check for this format: Player i wins!.
    • Having both players set to attack : 0 causes an infinite loop. If you want this edge case to be part of the puzzle, the instructions should indicate how to deal with it.
    • Some unit tests that should end in mutual death expect a player to win. This is becuase you're testing player.health == 0, rather than player.health <= 0. Player health can be negative too.
  • Custom User Avatar

    Kata Description and Sample Test Cases are inconsistent with actual Test Cases - description / sample tests expect string of format "Player[i] wins!" to be returned unless there is a tie but actual tests expect string of format "Player [i] wins!" to be returned instead.

  • Custom User Avatar
    • Your solution will fall into dead loop when battleAlgorithim({ health: 27, attack: 0 },{ health: 27, attack: 0 })
    • either player has 0 or less health at the end of the turn But you test with player1.health == 0 && player2.health == 0