COMP 14-090 Summer I 2000
Assignment 5: Video Poker (part I)
Assigned: Friday, June 9
Due: Thursday, June 15
Worth: 80 points
Description
Write a text-based video
poker game. A description of the game and rules for scoring video
poker are below. Allow the user to play the game until he or she
decides to quit. For this assignment, you do not have to implement
the discard round of gameplay. Tally the score after dealing the
initial five cards. (Note: You will have to implement discard in
assignment 6.) Don't reshuffle the deck after every hand -- only
reshuffle when necessary (i.e., when you won't have enough cards to play
a complete hand).
The templates for all of the classes (including instance
variables and method headers) have been provided. Though, you will
still need to add your own support methods to assist the tallyPoints method
(such as hasFlush(), hasFullHouse(), ...). It is your assignment
to fill in the functions of the game. You may design the user
interface in any manner you like, but one requirement -- print to the
screen only in the playTextGame method (this will help in
assignment 6). Extra credit will be given for outstanding user
interfaces.
What to Turn In
-
A printout of your Java source code.
-
A disk with your Java source code (Card.java, Deck.java, and VideoPokerGame.java)
and bytecode (Card.class, Deck.class, VideoPokerGame.class).
-
An image of the output window. Make sure you see "==> End of job" before
you capture the image. (You may include the output window image in the
same document as your memo instead of turning in a separate printout of
the output window.)
-
A memo describing the problem and your solution of it. Include any problems
you encountered or comments you may have about the assignment. Also, include
an estimate of the total amount of time you spent working on this assignment.
Steps to Follow
-
Follow the instructions in Getting Started with Visual
J++ under "Creating a New Project."
Use Assignment5 as your project name.
-
Follow the instructions under "Adding a
New Class." Name your class VideoPokerGame.
-
For the Card and Deck classes, follow the instructions under
"Adding a New Class" except choose
Class
instead of ClassMain.
-
For each of the classes you've created, copy and paste the templates from
the sample source code web page: VideoPokerGame.java
Deck.java
Card.java
-
Fill in the parts marked /* Insert your code here */ with code
that you write.
-
Save often!
Notes
-
Test your program with various numbers as input. The program should not
crash or report errors when given numerical inputs.
-
Don't forget to comment your program! If there are no comments, you will
lose at least 25% of the points.
-
Don't forget to virus check and label your disk according to the instructions
in Turning in Assignments on Disk.
-
Don't forget to sign the pledge on the printout of your source code.
Hints
-
Think about re-using your own methods. For instance, a straight flush
is simply a hand that is both a straight and a flush.
-
To shuffle the deck, swap random pairs of cards a large number of times
(at least 1000).
Rules of Video Poker
The player is dealt 5 cards from a shuffled deck. The player then decides
which cards, if any, to hold. The rest are discarded. The dealer
replaces the discards, if any, with the next cards from the deck.
This marks the end of the hand -- time to tally the score.
Face order (lowest to highest): 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen,
King, Ace
Scoring
1 Jacks or Better -- a pair of Jacks or higher
2 Two pair
4 Three of a kind
6 Straight -- any 5 cards in consecutive value order
10 Flush -- all 5 cards are in the same suit
14 Full House -- a pair and a three of a kind
20 Four of a Kind
40 Straight Flush -- satisfies both Flush and Straight
100 Royal Flush -- Straight Flush that goes 10 - Ace
Michele Clark
clark@cs.unc.edu