7 kyu

Hearts (Card Game) Kata 1 of 3

Description
Loading description...
Games
Puzzles
  • Please sign in or sign up to leave a comment.
  • danik00111 Avatar

    Maybe change the "10" to "T", so that it's one character, just like all other ranks.

  • Just4FunCoder Avatar

    This comment has been hidden.

  • Mednoob Avatar

    Please add to the description a case/input when the card that is the only card of a certain suit is not at index 0. The current description makes it looks like when we met cards that are the only card of a certain suit, it matches them directly regardless of position, but this is not the case in the actual tests.

    • p4songer Avatar

      Thanks for the suggestion about adding more clarity to the description! I just wanted to make sure I was understanding you about what specifically you wanted changed, because it sounds like this might be a potential issue with my code, or one of the unit tests.

      When an array is given, it should be assumed that the first card in the array is the suit for that hand. All other cards played must match the suit in order to be considered for winning. If there is no other card played that matches the suit in position 0, the card in position 0 will always win. If two, or three, or four cards are suited, then the card with higher value will win.

      If that is the experience you had with the actual tests, I think we're good as far as code correctness, if you got a failed test after providing a correct answer, please give me an example with the input, and the output and I'll get it fixed asap. Otherwise, I did add a new example to the description so that given the input: ['9D', '9C', 'QD', '9S'] we should expect the output: 'QD'

      Suggestion marked resolved by p4songer 2 years ago