6
\$\begingroup\$

One single proposal per answer, most upvoted as of 2013-12-07 (12:00AM UTC) becomes our next challenge!

The winning entry shall be marked as the accepted answer.

index | next challenge

\$\endgroup\$
6
\$\begingroup\$

Poker Hand Evaluation

Fizz-Buzz-Banana is too easy. Evaluating a poker hand demands a bit more brain juice, and has many ways of turning into spaghetti conditionals that are going to be fun to review.

Specs

Oddly this is missing the unachievable Royal Flush (10-J-Q-K-A, all in the same suit), but I didn't look very far for something usable with a CC-Wiki license:

poker hand rankings http://www.pokermedley.com/rules/hand-rankings/

\$\endgroup\$
  • 3
    \$\begingroup\$ There's nothing special about a royal flush in poker: it's just a straight flush to an ace. \$\endgroup\$ – Gareth Rees Dec 5 '13 at 23:24
  • 2
    \$\begingroup\$ And yet they gave it a name... \$\endgroup\$ – Mathieu Guindon Dec 5 '13 at 23:34
  • 1
    \$\begingroup\$ Alright, this is the current challenge! \$\endgroup\$ – Simon Forsberg Dec 7 '13 at 0:44
  • \$\begingroup\$ This challenge doesn't seem fully defined. What should code implementing this challenge do? Should it accept a representation of a hand and return something indicating which of the types of hands it contains? Should it compare two hands for a winner? Should it draw the above image? \$\endgroup\$ – Michael Urman Dec 8 '13 at 17:29
  • \$\begingroup\$ @Michael specs are purposely loose, so that we don't end up with 10 identical questions. As long as your code can tell the poker hands in a bunch of cards, you've got an entry :) last week all we knew was "implement the rock paper scissors lizard spock problem" - loose specs is part of what makes it fun, you never know how far people are going to push it! \$\endgroup\$ – Mathieu Guindon Dec 8 '13 at 19:12
  • \$\begingroup\$ @MichaelUrman I have to agree with retailcoder. The important part of the challenge is to find the best poker hand given a set of cards. How big you want that set of cards to be and how much more features you want to add to it, that's up to you. (I included support for wildcards for example) \$\endgroup\$ – Simon Forsberg Dec 10 '13 at 9:29
  • \$\begingroup\$ @SimonAndréForsberg While I agree with the intent of keeping things open (we don't need CR to become a targeted programming competition; it sees enough of those samples already), I don't see where this description says to find the best poker hand given a set of cards. It's not a huge leap to guess that's what retailcoder meant, but it's far from explicit. In a code review that's a scenario I'd push for the writer to add some comments or documentation. Anyway, thanks for clarifying the lack of clarity; it's fun to see the results. :) \$\endgroup\$ – Michael Urman Dec 10 '13 at 13:20
1
\$\begingroup\$

Fizz-Buzz-Banana

Fizz-Buzz is too easy. Let's stir things up a bit and add a little spice - Banana is whatever you want it to be, and if you want you can add Apple, Orange and Cherry as well.

Specs (for those who need them)

Players generally sit in a circle. The player designated to go first says the number "1", and each player thenceforth counts one number in turn. However, any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. A player who hesitates or makes a mistake is eliminated from the game.

http://en.wikipedia.org/wiki/Fizz_buzz

\$\endgroup\$
  • \$\begingroup\$ Or, since it's kinda hard to simulate these "players", just print out what those players would say in the range 1-n (where n is an arbitrary number, or a number received from input). \$\endgroup\$ – Simon Forsberg Dec 5 '13 at 21:34
  • \$\begingroup\$ As I would like to learn some new languages, I'm voting for this! \$\endgroup\$ – Simon Forsberg Dec 5 '13 at 21:35
  • \$\begingroup\$ Fizzbuzz doesn't really teach you a language. It just gives you a mild sample. With google and some concentration you coud probably make fizz buzz within an hour even if you've never used the language before. \$\endgroup\$ – Daniel Dec 5 '13 at 22:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .