Before we launch into this assignment, let's take a look at the solution for assignment 5:

## Assignment #6 – Fun with Enums

In this assignment we are going to use our knowledge of Enums to create a Texas holdem poker game!

If you aren't familiar with Texas holdem poker, you can become acquainted with the generic rules of poker here.

This particular assignment won't be to implement the entire breadth of the game, but rather, to implement the key elements of the game of poker so that we can expand on it later. So let's talk about the elements that you'll need to implement for this assignment.

You are required to create a Deck of Cards that can be used in our poker game. The deck should be a standard deck of cards consisting of 52 cards made up of 4 different Suits (diamonds, clubs, hearts, spades) with Values ranging from TWO to ACE.

Once you have your Deck of cards setup, the next thing you need to do is be able to:

• Deal cards to Players

Having said that, you will also need to create Players, these players will have one Hand of cards. Each hand will consist of two distinct cards from the deck.

Not only do you need to deal cards to players, but you also need to deal the “community cards”. For this iteration of the assignment, let's just deal five community cards right away. I don't want to put the “betting” aspect into this assignment just yet.

Once you have dealt all players their hands (two cards each), and you have dealt the five community cards, then you'll need to figure out which player has the best hand. To do this, you'll need to know which type of hand beats another, so here's the list:

(picture credit goes to www.betshoot.com)

You'll need to output each players' hand in the console window, as well as the community cards. Once you determine which player is the winner, you should output which player won and with what hand. In the event that there is a tie (i.e. two players hold the same winning hand), you'll need to determine which of the winning hands has the higher value cards. So if both players have three of a kind, then the player with the three higher value cards wins (i.e. Player 1 has three jacks, but Player 2 has three aces… aces > jacks therefore Player 2 wins).

A draw will occur only if the values of the winning hands are exactly the same (i.e. two players have three of a kind with kings and identical ‘non-winning' cards)… In the event that two players each have the same winning cards, but different non-winning cards (i.e. Player1 has three aces a king and a jack, Player2 has three aces, a jack and a four), then the player with the higher “kicker” card wins (i.e. Player1 wins because their king kicker beats Player2's jack kicker).

Note: This assignment is more difficult than most other assignments I have posted on this blog. It took me roughly 12 hours of coding to complete this assignment. The good news for you is that I have included a good chunk of the coding in the assignment source files that you can download below.

## What You'll Learn

This assignment should make heavy use of Data Structures, namely Lists and Maps. Everybody's solution will be different, so if you don't use these data structures, then no worries… However, I do believe you will need to use them to make your life a little easier.

You will also learn how to Sort Collections, this will be mandatory, as it will be very difficult to determine which player has won without being able to sort the cards.

My solution even uses a little Recursion, now whether or not you choose to do this is up to you, but I believe it made my solution simpler.

Also, here's the GitHub Clone URI: https://github.com/tp02ga/JavaPracticeAssignment6.git