4 kyu

Beggar Thy Neighbour

Description
Loading description...
Games
Algorithms
  • Please sign in or sign up to leave a comment.
  • brodiemark Avatar

    Suggestion: At the end of the description, after "with player 2 eventually winning", add something like "so the program should return 1, the player's index."

    I think this will prevent the confusion that many people have encountered, as indicated futher down in the discourse below. The description does state at the top that the index should be returned, but it's easy to forget this by the time you get to the bottom.

  • ahmet_popaj Avatar

    Great kata, thanks.

  • benjaminzwhite Avatar

    Hi @ChristianECooper - thanks for a great kata, with just the right balance of designing-to-debugging!

    On a personal note, as a beginner programmer, I remember reading these kind of katas a few weeks ago and having no idea where to start but after practicing on Codewars I'm finding that I'm starting to break things down systematically now and it all becomes much more approachable.

    So, to anyone 5-6 kyu reading the Discourse for advice, stick with this kata if you are struggling - it's really worthwhile and good practice.

  • RealKenshiro Avatar

    Great kata with the right amount of difficulty. Thanks to the author.

  • rge123 Avatar

    Really satisfying thanks :) I love a kata where you can simulate it in real life to help!

  • Kappa_ Avatar

    sorry for the stupid question, but what if a player ran out of cards in his hand? does he lose immediately? I think I don't understand...

  • mauro-1 Avatar

    Suggested by Blind4Basics 3 years ago, but description is still very confusing:

    ...Though it presents an important lack in the description: You forgot to explain what was the excpected return format: by reading it, I expected to have to return 1 or 2, not 0 or 1...!

  • Ishan-1 Avatar

    The question is if for example , during a penalty, I have to play 2 cards and the first one is a special card. So do I have to play the second one then or the penalty will be reversed without playing it?

  • dashhh Avatar

    This comment has been hidden.

  • docgunthrop Avatar

    Fun kata. @ChristianECooper, have you considered translating this to other languages (or do you accept translations)?

  • G_kuldeep Avatar

    Fun Kata :)

  • Blind4Basics Avatar

    Very interesting/pleasant one.

    ...Though it presents an important lack in the description: You forgot to explain what was the excpected return format: by reading it, I expected to have to return 1 or 2, not 0 or 1...!

    EDIT: btw, you might want to modify the way you organized the presentation ot the tests (describe/it). Currently, we get that:

    Example
    Test Passed
    Test 1
    Test Passed
    Test 2
    Test Passed
    Test 1
    Test Passed
    Test 1
    Test Passed
    Test 2
    Test Passed
    Test: 1
    Test Passed
    Test: 2
    Test Passed
    Test: 3
    Test Passed
    Test: 4
    Test Passed
    Test: 5
    Test Passed
    Test: 6 
    
  • zruF Avatar

    This kata was fun, thanks! :)