ICS 111 Homework Assignment H07: Two-Dice Pig Game

Purpose

We are going to continue our problem-solving education by writing a program that plays the Two-Dice Pig game. This will help us understand loops, branching and subroutines.

We will also get more practice using Eclipse to make our programming life easier.

Tasks

1. Create a package named edu.ics111.h07 in your ICS111-workspace project

This is where we will put all our classes for homework 07.

1) Write a program that allows players to play the game Two-Dice Pig. The name of the class that plays the game is TwoDicePigGame.

The rules of Two-Dice Pig are:

Each turn, a player repeatedly rolls two dice until a 1 is rolled or the player decides to “hold”:

The first player to 100 or more points wins.

The program should ask for the number of players, then create an array of Players. The Player class should have a name instance variable and a score instance variable. Once the players are initialized the program should start playing the game by giving each player a turn.

The program should have a function named playerTurn that allows the player to decide when to “hold”. The function must return the score for the player’s turn.

The program should use an instance of the class PairOfDice to do the rolling of the dice. (See the text for examples of the class.)

Grading Rubric

CriterionExcellent (100%)Satisfactory (75%)Borderline (50%)Unsatisfactory (25%)Poor (0)
Adherence to standards - 2 points
Does it conform to standards in every detail?
No errors. Minor details of the assignment are violated, or poor choices are made where the assignment is unclear. Significant details of the assignment or the underlying program intent are violated, but the program still fulfills essential functions. Significant details of the assignment or the underlying program intent are violated, but the program still fulfills some essential functions. Misses the point of the assignment.
Breakdown (modular design) - 2 points
Does it demonstrate good modular design?
No errors. 1-3 minor errors. > 3 minor errors OR 1 major error. 2 major errors > 2 major error.
Correctness of code - 4 points
Does it work? Does it pass JUnit?
Passes all tests. Works for typical input, may fail for minor special cases. Fails for typical input, for a minor reason. Fails for typical input, for a major reason. No.
Documentation, and style - 2 points
Is it clear and maintainable? Does it pass CheckStyle?
No errors. 1-3 minor errors. > 3 minor errors OR 1 major error. 2 major errors > 2 major error.

Turning in the Assignment

The assignment is due on Friday, October 22nd at 11:55pm. You may turn it in early.