CMSC 132 -- Project 1

Due: Friday 2/11/05 at 11:00 PM

Texas Hold 'Em Simulator

Closed Policy

This is a closed project.  You are expected to do all of the work on this project without consulting with anyone other than the CMSC 132 instructors and TAs.  Treat this project as though it were a take home exam.  If you have any questions about whether or not a certain topic is okay to discuss with classmates or friends, please ask your instructor.


This project will simulate something close to a game of Texas Hold 'Em, which is a style of poker.  If you don't know how to play this game (or if you've never played cards before in your life), don't worry -- we'll explain everything!  Most of this program will be written for you.  We will provide the graphical interface and most of the infrastructure for the project.  You will supply two components:  A method that will produce a shuffled deck of cards, and a method that takes 5 cards as input and determines what kind of poker hand it is.


To see what the finished product looks like, click the link below:

Click here to see the working project!


If you are not familiar with the standard deck of 52 playing cards and the terminology that goes along with it ("suit", "queen", "clubs", etc.), then please take a look at the Playing Card Page.

Poker Hands

If you are not familiar with poker hands, such as "Full House" or "Straight Flush", then please read the Poker Hand Page.  By the way, to successfully implement this project you need to know the definitions of these hands very precisely, so unless you are a real expert it would be a good idea to read this information carefully!

(Partial) Rules of Texas Hold 'Em

If you are not familiar with this game, then please read the Introduction to Texas Hold 'Em Page.

Project Layout

Most of this project has been completed for you.  There are only two methods that you must write (described later).

The full project consists of the following classes:

An instance of this class represents one playing card.  There are two fields that you will use:

Take a look at the class to see what methods are available -- you will use Card objects when you write other portions of the project.

You must implement the following method:

The method must create a List containing the 52 distinct cards found in the standard deck.  You may want to use the java library class ArrayList to represent the deck of cards.  If you have not used this class for a while you should begin by reading the java API for the ArrayList class. 

Important:  The deck must be shuffled before it is returned!  How you shuffle the deck is entirely up to you, but here is a hint:  You might save time using a method that is part of the Collections class.  If your deck is not randomly shuffled you will lose points!

You must implement the following method:

The parameter represents an array of five cards.  (It will always be exactly 5 cards).  Your method must rank the five card hand using the rankings described in the Poker Hands section.  Don't forget that if more than one ranking applies, we always select the highest one.

The return value must be selected from the following table:

Class Wiki

Occasionally project updates or important notices need to be released after the project has been posted. These notifications will be posted on the class wiki. It is your responsibility to check the class wiki periodically for such notices.

Web Accessibility