Starting from:
$29

$26.10

Project 1 Card game poker

Project 1 Instructions

1
1 Introduction
In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way:
• High Card: Highest value card. • One Pair: Two cards of the same value. • Two Pairs: Two different pairs. • Three of a Kind: Three cards of the same value. • Straight: All cards are consecutive values. • Flush: All cards of the same suit. • Full House: Three of a kind and a pair. • Four of a Kind: Four cards of the same value. • Straight Flush: All cards are consecutive values of same suit. • Royal Flush: Ten, Jack, Queen, King, Ace, in same suit.
The cards are valued in the order: 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace.
If two players have the same ranked hands then the rank made up of the highest value wins; for example, a pair of eights beats a pair of fives (see example 1 below). But if two ranks tie, for example, both players have a pair of queens, then highest cards in each hand are compared (see example 4 below); if the highest cards tie then the next highest cards are compared, and so on.
A more elaborate description of poker hand rankings can be found here: http://www.pokerlistings.com/poker-hand-ranking
2 Goal
The goal of this project is to write a program that given the hands of 2 players, evaluates the winner. You will be provided with poker.c and poker.h files. You are to complete the
2
specific tasks within the program, test it with the sample input and output, and write a Makefile to build the program named poker.
Input: You will be provided with a plain text file that contains random hands dealt to two players. Each line of the file contains nine cards (each card separated by a single space): the first two are Player 1’s cards, next two are Player 2’s cards and the last five are community cards. Each players best hand constitutes the best 5 cards from the player’s hand and the community cards combined. You can assume that all hands are valid (no invalid characters or repeated cards), each player’s hand is in no specific order, and in each hand there is a clear winner.
Output: You are to generate Output.txt where each line contains the winner of the corresponding hand in the input, either Player 1 wins or Player 2 wins. Do not print any other output to this file, including punctuation marks or other messages. Your output must match the required output precisely!
3 Sample Input and Output
Table 1: Sample input and expected output
Hand Player 1 Player 2 Community Winner Reason 1 5H 5C 8S 8D 3C 6D 7S TH QD Player 2 Pair of 8s beats pair of 5s
2 JS AC KC JH JC TD 2H 4S 6C Player 1
Pair of Jacks and High card Ace beats King 3 2C 4C AH AS TC 5C JD 4H AC Player 1 Flush beats 3 of a kind
4 AD 4C KC KH 3D 3C 3H 3S KD Player 1
Four 3’s and Ace beats four 3’s and King
5 4C 4D 3C 3D 4S 3S 9D 9C AH Player 1
Full house with 3 fours beats full house with 3 threes.
4 Teams & Submission
For this project, you may form a team of up to 3 members. Once you have formed a team, send one email addressed to both TAs at {mcole8,psinha1}@binghamton.edu with the names and Github usernames of each team member. The deadline to announce your
3
team is Friday, 10/15/17 by close of business. All work for your team must be placed in one repository. Submission instructions will follow separately.
4

More products