A fully functional game of Texas Hold 'em Poker written solely on Java. In the game, you play against the computer, winning when you take all the avalable money (2000) and losing when you run out of money. The game offers the ability to change cards and bet, giving the betting option to the computer too.
The game is easy to use if you know how to play and follows the following common rules (for Texas hold 'em Poker):
◦Every player is handed 2 cards, visible only to him. The last 5 cards of his full hand are actually the cards on the table
◦5 cards are opened on the table
◦Every player can make the best hand for him with only 5 of the 7 cards available (his hand and the table's cards combined)
◦The hands are ranked as such:
‣Straight Flush
‣Four of a Kind
‣Full House
‣Flush
‣Straight
‣Three of a Kind
‣Two Pair
‣Pair
‣High Card
The hands are better described below:
Straight Flush
A straight flush is the best natural hand. A straight flush is a straight (5 cards in order, such as 5-6-7-8-9) that are all of the same suit. As in a regular straight, you can have an ace either high (A-K-Q-J-T) or low (5-4-3-2-1). However, a straight may not 'wraparound'. (Such as K-A-2-3-4, which is not a straight). An Ace high straight-flush is called a Royal Flush and is the highest natural hand.
Four of a Kind
Four of a kind is simply four cards of the same rank. If there are two or more hands that qualify, the hand with the higher-rank four of a kind wins. If, in some bizarre game with many wild cards, there are two four of a kinds with the same rank, then the one with the high card outside the four of the kind wins. General Rule: When hands tie on the rank of a pair, three of a kind, etc, the cards outside break ties following the High Card rules.
Full House
A full house is a three of a kind and a pair, such as K-K-K-5-5. Ties are broken first by the three of a kind, then pair. So K-K-K-2-2 beats Q-Q-Q-A-A, which beats Q-Q-Q-J-J. (Obviously, the three of a kind can only be similiar if wild cards are used.)
Flush
A flush is a hand where all of the cards are the same suit, such as J-8-5-3-2, all of spades. When flushes ties, follow the rules for High Card.
Straight
A straight is 5 cards in order, such as 4-5-6-7-8. An ace may either be high (A-K-Q-J-T) or low (5-4-3-2-1). However, a straight may not 'wraparound'. (Such as Q-K-A-2-3, which is not a straight). When straights tie, the highest straight wins. (AKQJT beats KQJT9 down to 5432A). If two straights have the same value (AKQJT vs AKQJT) they split the pot.
Three of a Kind
Three cards of any rank, matched with two cards that are not a pair (otherwise it would be a Full House . Again, highest three of a kind wins. If both are the same rank, then the compare High Cards.
Two Pair
This is two distinct pairs of card and a 5th card. The highest pair wins ties. If both hands have the same high pair, the second pair wins. If both hands have the same pairs, the high card wins.
Pair
One pair with three distinct cards. High card breaks ties.
High Card
This is any hand which doesn't qualify as any one of the above hands. If nobody has a pair or better, then the highest card wins. If multiple people tie for the highest card, they look at the second highest, then the third highest etc. High card is also used to break ties when the high hands both have the same type of hand (pair, flush, straight, etc).
john.athanasopoulos.dim@gmail.com
Hope you have fun and don't hesitate to contact me if you have any questions. I would be glad to help!
John Athanasopoulos
Atermon.
