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.
lose()
is also called inconsistently: fixed test passes in one card while random tests pass in an array of 2 cards.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.
Heya siebenschlaefer,
Thanks for the detailed feedback, sorry for causing you frustration I did this a good while ago and kind of forgot about it.
I'll get to fixing it up ASAP.
Thanks again!!
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.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Really cool stuff, I hadn't looked at Nokogiri's API properly before so I'm really glad you made this!
Yep, if anyone else is stumped just reading the unit tests remember that the arrays are columns going down from left to right, for example:
The following mine:
mine = [[1,2,3], [4,5,6],[7,8,9]]
would not look likebut rather like:
This makes the right/left/up/down directions easier to visualise although it doesn't really affect the problem.
That's very strange, have you clicked the republish button to update it? I tested on one of mine and that seems to do the job. I know codewars and certain browser plugins don't play very nicely, certainly adblockers and ghostery; that could be preventing a save?
Can shout out to any JavaScript people, I created a (reasonably) difficult kata and can't get people to try it... It's probably a Lv4?
If anyone wants to give it a go and try get it out of beta that would be great!
https://www.codewars.com/kata/horror-top-trumps-card-game
@BattleRattle Can you approve or comment on the Ruby translation please?
What browser are you in? Have you any browser extensions that block scripts like adblockers? Might be something like that?
Is there any copy & pasted code in your solution? Sounds like there's some characters your keyboard didn't produced getting submitted.
Try paste into notpad and back in, might strip some character encoding; or better yet, write your answer from scratch.
Loading more items...