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 kata needs random tests.
This comment is hidden because it contains spoiler information about the solution
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.
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.
Nice kata, but there are two bugs:
play()
.But the predefined
Game
function passes either one argument (card) toplay()
or three (card, attribute, value).win()
, and similarly three out of five tests pass an array with an even number of cards tolose()
.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:
active
argument. The player knows if he is in 'defence' mode whenplay()
is called with anundefined
attribute
.value
argument.play()
does not use it to make its decision.Basically take the "rules" and add at least one test for each sentence.