Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This is a duplicate of https://www.codewars.com/kata/two-fighters-one-winner
Good kata, just a few bugs to fix:
Player[i] wins!
. The sample unit tests check for this format:Playeri wins!
. The actual unit tests check for this format:Player i wins!
.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.player.health == 0
, rather thanplayer.health <= 0
. Player health can be negative too.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.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 withplayer1.health == 0 && player2.health == 0