Ad
  • Custom User Avatar

    Unpublished!

  • Custom User Avatar

    And/or a testcase which always fails...

  • Custom User Avatar

    The first step you should take is to unpublish it in the kata editor. At least that way, even if you aren't able to successfully delete it, it won't show up in search results.

  • Custom User Avatar

    The puzzle is very nice. Yes, it's a puzzle.
    Don't read the description, since it's not the truth..
    If you write your code according to the description, You just need submit your solution again and again. If you're lucky, you will pass all the tests ;-) Otherwise, you will meet:

    one or two fighters have 0 health
    one or two fighters have 0 attack
    (author's solution will run 12 seconds, then you will got a fail)
    two fighters have the same health and attack, but author tell you player 1 win or player 2 win
    
  • 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