Ad
  • Custom User Avatar

    This kata needs random tests.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    The kata's premise is deeply flawed: it asks us to implement a player with some strategies, but the test simulates whole games and expects a very rigid fixed results (down to how many rounds are played and the aggregate stats of round results), which forces us to implement a specific strategy that has never been described by the kata at all. So we're left to guessing what the actual strategy to be implemented is.

  • Custom User Avatar

    The kata doesn't even specify how to open a round: if we should choose the strongest attribute, then why we always start with the first card? It isn't even optimal to play the first card in the fixed tests as the first card is quite weak.

    It also doesn't specify what should be done if the strongest attribute is shared by multiple attributes. The cards might not do this, but this still needs to be specified.

  • Custom User Avatar

    Nice kata, but there are two bugs:

    • As documented, four tests pass either zero or two arguments (attribute, value) to play().
      But the predefined Game function passes either one argument (card) to play() or three (card, attribute, value).
    • All tests pass an array with an even number of cards to win(), and similarly three out of five tests pass an array with an even number of cards to lose().
      But the tests "should respond to play when in 'defence' mode" and "should choose best attribute if opponent card is 'predicted'" pass only one object (card, not an array) to lose().

    Addtional suggestions:

    • Specify what to do if the opponent's card can be predicted but the players best choice is a draw. Following the current description the player should pick the strongest attribute even if that means he loses.
    • Get rid of the active argument. The player knows if he is in 'defence' mode when play() is called with an undefined attribute.
    • Get rid of the value argument. play() does not use it to make its decision.
    • Add some more fixed tests that test one specific aspect, e.g. "should reduce deck count on tie", "should chose best winning attribute if opponent card is 'predicted'", "should chose best attribute if opponent card is predicted and round cannot be won', "should add cards in corrrect order on win", "should chose tying attribute if opponent card is predicted and tie is best option".
      Basically take the "rules" and add at least one test for each sentence.