Ad
  • Custom User Avatar

    Not an issue

  • Custom User Avatar

    Reference solution appears to have bug when both hands have one or two pairs. I debugged my own solution quite exhaustively, and could not find mistakes.

    I could submit after some trying and getting favourable random tests, and I could not figure out exactly what the reference solution is doing wrong ( or at all ).

    So I might be wrong, but I doubt it. Marking as Issue because it probably is.

  • Custom User Avatar

    Initial code is self-contradictory:

    -- | Write function 
    --   betterHand :: Hand -> Hand -> Ordering
    betterHand :: Hand -> Hand -> Hand
    betterHand = error "Write me"
    

    The comment is incorrect.

  • Default User Avatar

    It's an elegance solution, but can be more efficient. sum is an expensive operation, and we can avoid sum using slide window, which like a deque.
    Your solution is O(n^2), yet the one using slide window can be O(n).

  • Default User Avatar

    duplicate

    (if your language isn't available with this one, you should rather do it's translation than create a new one)

  • Custom User Avatar

    Do you know which language this was in?

  • 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

    Hi, I'm the original author of this Kata (Ruby version). Author of the haskell version didn't understand this Kata properly, and indeed added a DFS version instead of BFS.

    I have learned haskell to fix this. I added a BFS solution and a correct buildTree (thanks to @nickie for providing one). Please take a look again.

    Thanks,
    Karol

  • Custom User Avatar

    I have shrinked test cases to 5 cards only. This makes kata more well-defined.

  • Custom User Avatar

    Random test says

    Falsifiable (after 5 tests): 
    QD AD 10H 8S 8S KC 
    JC 5H 8C AD 2C 5C 7C
    

    Wiki says "In games where more than five cards are available to each player, the best five-card combination of those cards must be played", so my solution selects second hand as having a flush of JC 8C 2C 5C 7C.

  • Default User Avatar

    This looks interesting, but I'm struggling to understand the Poker rules.

    The Wikipedia link shows 5-card hands and explains their ranking. But the tests seem to also test for 7-card hands. How do all those concepts translate? Is there a 3 pair, for example?

    Also, the second big hand should probably read "8C 6C 5C JC 7C 9C 10C" (instead of "8C 4..") so that it is actually a straight.

  • Custom User Avatar
    • "AC AC 3H 4D 5S" is better than "AC AC 2H 4D 5S" (at least when I tested it)
    • Description says: "From above definition it is clear that Hand can contain any number of cards", so random testing works correctly
  • Custom User Avatar

    Sorry, forgot to mention that if two hands are equal, first hand should be returned

  • Custom User Avatar

    betterHand function returns a Hand, so it is not clear what to do if hands are equal.

  • Loading more items...