Show Bid Request
Card Game
Bid Request Id: 10871
|
|
|
Posted by: |
needhelp (5 ratings)
(Software buyer rating 10)
|
Non-action Ratio: |
Above Average - 42.86%
|
Posted: |
Mar 14, 2002 9:37:40 PM EDT
|
Bidding Closes: |
Mar 28, 2002 9:44:36 PM EDT
|
Viewed (by coders): |
239 times
|
Deadline: |
3/17/2002
TIME EXPIRED
|
|
|
|
Description:
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 <stdlib.h> 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 <time.h> library for this function to work
correctly (see the program below for an example)
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
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:
a.out
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
Must be 100% finished and received by buyer on:
Mar 17, 2002 EDT
Deadline legal notes: All times are expressed in the time zone of the site EDT (UT - 5). If the buyer omitted a time, then the deadline is 11:59:59 PM EDT on the indicated date.
Special Conditions / Other:
I can't use global variables, structures,in this assignment. I must use functions, arrays, loops, pointers if needed.
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation please help out the site and report it. Thanks for your help.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
|
$40 (USD)
|
Mar 15, 2002 5:49:43 AM EDT
|
9.76
(Excellent)
|
|
|
I would be happy to make this program for you. The source will be well commented, easy to follow, meeting all you requirements. I won't use any programming elements others than those you specified. Also the program will be tested on Unix platform. You can *be sure* you will have it on time.
I hope the price is acceptable. Thanks for considering my bid, and if I can answer any questions for you, just let me know. |
|
|
|
This bid was accepted by the buyer!
|
$30 (USD)
|
Mar 15, 2002 11:30:57 AM EDT
|
9.76
(Excellent)
|
|
|
I hope this new bid will be acceptable. You can have the source(s) in the same day... just accept my bid. If you haven't already decided take a look on my references and... choose my bid :) I'm sure you won't be disappointed. Thx. |
|
|
|
|
|