Introduction to Programming (CPSC 124)
—Hobart & William Smith Colleges, Spring 2015
Project #3
Home | Syllabus | Calendar | Class Notes | Labs and Projects | General Notes

Due by 10:19 pm on Thursday, March 12

This assignment is a departure from previous ones in that is it somewhat open-ended, and you are encouraged—strongly encouraged— to work in groups of two or three on it. There is no required structure, no required set of features you have to use (though you'll find method definition very useful and the Scanner class essential), nor are the particulars of the interface constrained.

Your job is simply to produce a program that interactively plays a game of Pig with the user.

The Game of Pig

Pig is a dice game for two players. It involves one, six-sided die. The rules are simple:

Your job is to write a program that interactively prompts the user for a choice, simulates the roll of a die (if that's what is chosen), and updates the scores and the turn appropriately.

Here's a quick technique for randomly rolling a six-sided die:

roll = (int) (Math.random() * 6 + 1);

You may choose to make the second player either another user or a computer-based AI. If you choose the AI, that is worth an additional half-letter grade for the assignment.

Summary of Expectations

Turn In

John H. E. Lasseter