NWRUG

North West Ruby User Group

NWRUG Quiz: Poker Score Exercise

Let's write some code that can determine the best hand(s) in a game of poker! If you've never played poker before or need an overview of the poker hands, you can find a list of poker hands on Wikipedia.

To get started, download the test suite on the Exercise.io website.

If you don't have the Minitest gem installed, you'll need to run gem install minitest. Then define your Poker class in a file called poker.rb in the same directory as the tests and you're good to go: ruby poker_test.rb.

Taking things further

If you manage to get all the above tests passing, here are some ideas for ways you can take your code further:

1. Describe the hands

Extend your code so that it can give a textual description of a hand. For example, %w(9C AH KS KD 9D 3C 6D) would be "two pair"

2. Generate hands

Write some code that is able to generate a valid sets of hands from a single deck of cards.