Elixir Quiz

Weekly programming problems to help you learn Elixir

Poker part 4: Playing a game

Welcome to the seventh edition of Elixir Quiz. This week, we continue with our 5 card draw poker game. This week we will be finish off our game, so that we are able to play a hand against our AI.

A hand of poker

A hand of 5 card draw begins with each player receiving their 5 cards. Typically a round of betting will occur, in which players can place bets based upon how good their hand is, and how good they think it might be relative to the other players. After this round of betting, each player may discard any or all of their cards, receiving replacements.

A second round of betting occurs after the draw. The winner is then decided based on who holds the best cards.

For our game we can ignore the betting portion of the game (unless you really want to add it in)

The problem

Create an executable script that when run, allows the player to play a hand of 5 card draw with the AI players that we created the week before. The player should be able to see their initial hand, choose cards to discard, and then be shown the winner of the round along with the winning hand.

A Mix task might be useful for starting the game

How do I enter?

The Poker part 4 quiz runs from Saturday September 20th 2014 until Friday September 26th, 2014.

To enter, just complete the problem and post the code to our subreddit. Add this code to your existing poker project.

Example solutions

After the quiz period ends on September 26th, I will update this section and talk about some interesting solutions that were posted to our subreddit