Card Game

Ολοκληρωμένο Αναρτήθηκε Mar 14, 2002 Πληρώθηκε κατά την παράδοση
Ολοκληρωμένο Πληρώθηκε κατά την παράδοση

ASSIGNMENT SPECIFICATIONS: I have to write a C program that simulates the dealing of a "poker hand" for a single (1) player, displays that hand on the screen, and determines if the player has been dealt a "Flush" or a "Straight Flush" ONLY. The program will NOT accept any user input (data), but must display 100 hands (each on a single line). Your program must then continue to execute (starting once again from 0) until a Flush AND a Straight Flush are found. Those hands should then be displayed as well as the number of hands that were required to be dealt in order to achieve those hands (see sample runs below).

## Deliverables

BACKGROUND INFORMATION: A deck of 52 cards consists of 4 suits: Spades (S), Clubs (C), Diamonds (D), and Hearts (H), with each suit made up of 13 different card ranks: 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, and A (where J=Jack, Q=Queen, K=King and A=Ace). In the game of "POKER", each player is RANDOMLY dealt a series of 5 cards which constitues a player's "HAND". The cards are then evaluated to determine the "hand's" strength by looking for special combinations or sequences in the 5 card set. Poker Hand strengths in ascending order (weakest to strongest)are ranked as follows: 1. High Card only (any one: A, K, J, 10, etc.). 2. One Pair (any 2 cards of the same rank). 3. Two Pairs. 4. Three Of A Kind (any 3 cards of the same rank). 5. Straight (any consequtive sequence of 5 cards) (see below for an example). 6. Flush (any 5 cards of the same suit). 7. Full House (any Three Of A Kind AND any 1 Pair). 8. Four Of A Kind (4 cards of the same rank). 9. Straight Flush (any consequtive sequence of 5 cards of the same suit). 10. Royal Flush (A, K, Q, J, 10) of all the same suit. Examples of 5 randomly dealt "poker hands" are: hand1: AC-2D-7H-JS-AD (One Pair: "2 Aces"). hand2: 10S-9S-8D-6C-7D (Straight: "6-7-8-9-10"). hand3: 2S-3S-6S-QS-5S (Flush: "5 Spades"). hand4: KD-KH-4H-KS-QH (3 Of A Kind: "3 Kings"). hand5: JC-4D-JD-JH-4S (Full House: "3 Jacks AND 2 4's"). where the first piece of data represents the card's rank followed by the card's suit. (eg.) AC = Ace of Clubs 2D = 2 of Diamonds 7H = 7 of Hearts JS = Jack of Spades AD = Ace of Diamonds NOTE: The cards that are dealt may appear in any numerical value "rank" and in any suit, but no single card may appear more than once (no repeats). To generate a random number in C, you must use the function: (prototyped in the C library) int rand( ); that returns a random number between 0 and the symbolic constant RAND_MAX inclusive. You must also use the function: void srand(unsigned int seed); to create a unique set of random values each time the program is executed. You will also have to include the library for this function to work correctly (see the program below for an example) #include #include #include int main( ) { int i, number; srand(time(NULL)); for(i=0; i<5; i++) { number = rand( ); printf("random number is: %d\n", number); } return 0; } ASSIGNMENT SPECIFICATIONS: You are to write a C program that simulates the dealing of a "poker hand" for a single (1) player, displays that hand on the screen, and determines if the player has been dealt a "Flush" or a "Straight Flush" ONLY. The program will NOT accept any user input (data), but must display 100 hands (each on a single line). Your program must then continue to execute (starting once again from 0) until a Flush AND a Straight Flush are found. Those hands should then be displayed as well as the number of hands that were required to be dealt in order to achieve those hands (see sample runs below). NOTE: You must find the Flush & Straight Flush even if they were already found in your 100 hand deal! You will need to use ARRAYS to complete this assignment. As well, it is highly recommended that you use functions to modularize your program into several smaller parts! Programs without functions which are overly cumbersome or inefficient may result in your instructor deducting marks. Sample runs of the program are: [url removed, login to view] AC-2D-7H-JS-AD 10S-9S-8D-6C-7D KD-KH-4H-KS-QH JC-4D-JD-JH-4S ... (assume 100 such hands have been dealt). Finding Flush & Straight Flush... 2S-3S-6S-QS-5S (Flush) after 198 hands! 8C-9C-5C-7C-6C (Straight Fl

## Platform

Unix, IBM RS/6000

## Deadline information

I can't use global variables, structures,in this assignment. I must use functions, arrays, loops, pointers if needed.

Γλώσσα Προγραμματισμού C Μηχανολογία MySQL PHP Αρχιτεκτονική Λογισμικού Δοκιμή Λογισμικού

Ταυτότητα Εργασίας: #2842311

Σχετικά με την εργασία

14 προτάσεις Απομακρυσμένη εργασία Ενεργό Mar 15, 2002

Ανατέθηκε στον:

pickingapples

See private message.

$25.5 USD σε 14 μέρες
(43 Αξιολογήσεις)
4.8

14 freelancers κάνουν προσφορές κατά μέσο όρο $39 για αυτή τη δουλειά

smartpin

See private message.

$34 USD σε 14 μέρες
(60 Αξιολογήσεις)
5.0
hardwiredvw

See private message.

$85 USD σε 14 μέρες
(19 Αξιολογήσεις)
4.8
leepwo

See private message.

$76.5 USD σε 14 μέρες
(41 Αξιολογήσεις)
4.7
royce3

See private message.

$21.25 USD σε 14 μέρες
(12 Αξιολογήσεις)
4.3
teamsgreen

See private message.

$34 USD σε 14 μέρες
(48 Αξιολογήσεις)
4.3
vhdeprecated

See private message.

$29.75 USD σε 14 μέρες
(32 Αξιολογήσεις)
4.2
fishconsulting

See private message.

$42.5 USD σε 14 μέρες
(18 Αξιολογήσεις)
2.9
iustinamihaesei

See private message.

$17 USD σε 14 μέρες
(4 Αξιολογήσεις)
1.7
s01000101

See private message.

$14.45 USD σε 14 μέρες
(3 Αξιολογήσεις)
1.1
changevw

See private message.

$42.5 USD σε 14 μέρες
(2 Αξιολογήσεις)
0.5
chadbergeron

See private message.

$8.5 USD σε 14 μέρες
(0 Αξιολογήσεις)
0.0
richardmluk

See private message.

$51 USD σε 14 μέρες
(0 Αξιολογήσεις)
0.0
vw268752vw

See private message.

$63.75 USD σε 14 μέρες
(0 Αξιολογήσεις)
0.0