Ad
  • Custom User Avatar

    This kata needs random tests.

  • Custom User Avatar

    lose() is also called inconsistently: fixed test passes in one card while random tests pass in an array of 2 cards.

  • 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

    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!!

  • 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.
  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Really cool stuff, I hadn't looked at Nokogiri's API properly before so I'm really glad you made this!

  • Custom User Avatar

    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 like

      x0 x1 x2
    y0 1 2 3
    y1 4 5 6
    y2 7 8 9

    but rather like:

      x0 x1 x2
    y0 1 4 7
    y1 2 5 8
    y2 3 6 9

    This makes the right/left/up/down directions easier to visualise although it doesn't really affect the problem.

  • Custom User Avatar

    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?

  • Custom User Avatar

    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

  • Custom User Avatar

    @BattleRattle Can you approve or comment on the Ruby translation please?

  • Custom User Avatar

    What browser are you in? Have you any browser extensions that block scripts like adblockers? Might be something like that?

  • Custom User Avatar

    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...