Programming and Problem Solving II - Homework 5 | CECS 274, Lab Reports of Computer Science

Material Type: Lab; Class: Programming & Problem Solving II; Subject: Computer Engr & Computer Sci; University: California State University - Long Beach; Term: Spring 2003;

Typology: Lab Reports

Pre 2010

Uploaded on 08/19/2009

koofers-user-ec8
koofers-user-ec8 🇺🇸

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CECS 274 Programming and Problem Solving II
Assignment 5 (20 points)
Due Thursday, April 24, 2003
Continuing from Lab4, this assignment will move us closer to a card-game software. For this assignment,
you will expand on a driver program, create a data structure designed to hold a play entry with the following
information: player ID, bet for the play entry, and the hand of cards for this play entry, and a data structure
designed to keep track of a card game such as poker. The driver program is provided to you in a file named
lab5.cpp. You will also need a List class, which is based on the simple linked list implementation given in
Chapter 4 of our textbook, as well as the Card, Deck, and Hand classes that you developed in previous
assignments.
INPUT: Response to program prompts for player names, and bet amounts.
OUTPUT: The 5-card hand that each player receives from the initial dealing of 5 cards in a card game in the
following format:
Player Name Card1 Card2 Card3 Card4 Card5 Ante Amount
Output each hand on a separate line. As developed in the Hand class in Lab4, the value of a card
should show the face value (A for Ace, 2 for Two, , T for Ten, J for Jack, Q for Queen, K for
King), followed by the suit (C for Club, D for Diamond, H for Heart, S for Spade.) For example,
a Three of Spade should be displayed as 3S.
REQUIREMENTS:
Use the Card, Deck, and Hand classes you developed in previous assignments, i.e., specifications
on these classes as given in previous assignments still apply.
Create a PlayEntry class for holding information of an entry in a card game like poker. A
PlayEntry object should record a hand, the player of this hand (using player ID would suffice),
and the current bet amount on this particular hand.
Create a Game class to keep track of a particular game. It should record the current total amount
of bets in the pot, and a list of all play entries that are still in the game (i.e., play entries with
hands that are not yet folded). Use the List class as provided in the collection of files in
~lam/274/lab5 to keep track of all the play entries in a given game. The List class is
implemented with exception handling. When using functions in the List class that are
implemented with exception handling, appropriate catch blocks must be included.
Use the Player struct provided in Player.h for the recording of player information. Add more
fields and functions if necessary.
Use the driver program provided in ~lam/274/lab5/lab5.cpp as a basis to complete the
implementation of the initial round of card dealing in this card game software.
Demo must be done using the UNIX make command.
Do the following:
Create a lab5 subdirectory in your 274 subdirectory, and copy all publicly readable files from
~lam/274/lab5 into your lab5 directory.
Also copy all the .h and .cpp files for the Card, Deck, and Hand classes you completed in previous labs
into your lab5 directory.
Document your program following the Program Documentation Guide which may be accessed through
http://www.cecs.csulb.edu/~lam/cecs274/course-notes.html. Specifically, document every function in all
classes in the form of a contract, for the PlayEntry anf Game classes you develop as well as all other
non-library classes that you need to use or complete. Make sure that all comments designed for
instruction purpose are removed or replaced where appropriate.
Use UNIX "make" command to simplify your compile and link procedure.
Turn in a copy of your source code, the makefile, and output of a test run.
Demo your program on the due date. Demo must be done using the UNIX make command.
Shui Lam (Spring 2003)
pf2

Partial preview of the text

Download Programming and Problem Solving II - Homework 5 | CECS 274 and more Lab Reports Computer Science in PDF only on Docsity!

CECS 274 Programming and Problem Solving II

Assignment 5 (20 points)

Due Thursday, April 24, 2003

Continuing from Lab4, this assignment will move us closer to a card-game software. For this assignment, you will expand on a driver program, create a data structure designed to hold a play entry with the following information: player ID, bet for the play entry, and the hand of cards for this play entry, and a data structure designed to keep track of a card game such as poker. The driver program is provided to you in a file named lab5.cpp. You will also need a List class, which is based on the simple linked list implementation given in Chapter 4 of our textbook, as well as the Card, Deck, and Hand classes that you developed in previous assignments. INPUT : Response to program prompts for player names, and bet amounts. OUTPUT : The 5-card hand that each player receives from the initial dealing of 5 cards in a card game in the following format: Player Name Card1 Card2 Card3 Card4 Card5 Ante Amount Output each hand on a separate line. As developed in the Hand class in Lab4, the value of a card should show the face value (A for Ace, 2 for Two,  , T for Ten, J for Jack, Q for Queen, K for King), followed by the suit (C for Club, D for Diamond, H for Heart, S for Spade.) For example, a Three of Spade should be displayed as 3S. REQUIREMENTS :  Use the Card, Deck, and Hand classes you developed in previous assignments, i.e., specifications on these classes as given in previous assignments still apply.  Create a PlayEntry class for holding information of an entry in a card game like poker. A PlayEntry object should record a hand, the player of this hand (using player ID would suffice), and the current bet amount on this particular hand.  Create a Game class to keep track of a particular game. It should record the current total amount of bets in the pot, and a list of all play entries that are still in the game (i.e., play entries with hands that are not yet folded). Use the List class as provided in the collection of files in ~lam/274/lab5 to keep track of all the play entries in a given game. The List class is implemented with exception handling. When using functions in the List class that are implemented with exception handling, appropriate catch blocks must be included.  Use the Player struct provided in Player.h for the recording of player information. Add more fields and functions if necessary.  Use the driver program provided in ~lam/274/lab5/lab5.cpp as a basis to complete the implementation of the initial round of card dealing in this card game software.  Demo must be done using the UNIX make command. Do the following:  Create a lab5 subdirectory in your 274 subdirectory, and copy all publicly readable files from ~lam/274/lab5 into your lab5 directory.  Also copy all the .h and .cpp files for the Card, Deck, and Hand classes you completed in previous labs into your lab5 directory.  Document your program following the Program Documentation Guide which may be accessed through http://www.cecs.csulb.edu/~lam/cecs274/course-notes.html. Specifically, document every function in all classes in the form of a contract, for the PlayEntry anf Game classes you develop as well as all other non-library classes that you need to use or complete. Make sure that all comments designed for instruction purpose are removed or replaced where appropriate.  Use UNIX " make " command to simplify your compile and link procedure.  Turn in a copy of your source code, the makefile, and output of a test run.  Demo your program on the due date. Demo must be done using the UNIX make command. Shui Lam (Spring 2003)

CECS 274 Programming and Problem Solving II

Poker Hand Definition

Royal flush 10, J, Q, K, A all in the same suit.

Straight flush A straight all in the same suit that is not a royal flush.

Four of a kind Four cards in the hand have the same face value. For example,

4 Threes and a Nine.

Full house Three cards of one face value and 2 cards of another face value.

For example, 3 Jacks and 2 Eights.

Flush Five cards all in the same suit, but not a royal or straight flush.

Straight A straight that is not a royal or straight flush.

Three of a kind Three cards of one face value, a 4th card of a second value, and a

5th card of a third value.

Two pairs Two cards of one face value, 2 more cards of a second value, and

the remaining card a third value.

One pair Two cards of one face value, but not classified above. For example,

2 Kings, a Jack, a Nine, and a Six.

Nothing None of the above.

Shui Lam (Spring 2003)