Assignment 5: Yahtzee

Objectives

Introduction

Yahtzee is a fun dice game currently marketed by Hasbro.

Assignment

Implement the necessary classes to make the code in /c/cs427/hw5/Required play a simplified version of Yahtzee with no Yahtzee bonuses or Yahtzee jokers.

Design your code to be easily reusable. The current implementation of main uses one of two factories to create a game object. For this assignment, those can be objects that implement the same rules. But for the next assignment, the MysteryYahtzeeFactory should create a version of the game using rules that will be given later. Much of your grade for the next assignment will be based on how much code you have to add or modify to implement the new game. You should think about how to implement other similar games (for example, the standard version of Yahtzee with bonuses and jokers, Yatzy, Generala, and Kismet) to get a good idea of what designs will work well for the next assignment.

Other Requirements and Non-requirements

Graduate Requirement

For graduate credit, compile with the CPSC527 symbol defined, which enables the code in main that abstracts the current position in the game (scoresheet + current turn + location in turn) into a separate object.

Example

A partial transcript of a game follows. Note that at the end of a turn, the abbreviations of unused categories are displayed in the order the corresponding categories appear on the scoresheet.
     Aces
     Deuces
     Treys
     Fours
     Fives
     Sixes
   0 UPPER BONUS
     Three of a Kind
     Four of a Kind
     Full House
     Small Straight
     Large Straight
     Chance
     Yahtzee
   0 GRAND TOTAL

[ 2 2 4 5 6 ]
REROLL 1
22
[ 1 2 2 2 5 ]
REROLL 2
222
[ 2 2 2 2 4 ]
1 2 3 4 5 6 3K 4K FH SS LS C Y
2
     Aces
   8 Deuces
     Treys
     Fours
     Fives
     Sixes
   0 UPPER BONUS
     Three of a Kind
     Four of a Kind
     Full House
     Small Straight
     Large Straight
     Chance
     Yahtzee
   8 GRAND TOTAL

[ 2 2 3 3 6 ]
REROLL 1
23
[ 1 1 2 3 5 ]
REROLL 2
235
[ 2 3 5 5 5 ]
1 3 4 5 6 3K 4K FH SS LS C Y
3K
     Aces
   8 Deuces
     Treys
     Fours
     Fives
     Sixes
   0 UPPER BONUS
  20 Three of a Kind
     Four of a Kind
     Full House
     Small Straight
     Large Straight
     Chance
     Yahtzee
  28 GRAND TOTAL

[ 3 3 4 4 6 ]
REROLL 1
3344
[ 3 3 3 4 4 ]
REROLL 2
33344
[ 3 3 3 4 4 ]
1 3 4 5 6 4K FH SS LS C Y
FH
     Aces
   8 Deuces
     Treys
     Fours
     Fives
     Sixes
   0 UPPER BONUS
  20 Three of a Kind
     Four of a Kind
  25 Full House
     Small Straight
     Large Straight
     Chance
     Yahtzee
  53 GRAND TOTAL

Submissions

Submit whatever source code (.cpp and .hpp) files you created and a makefile that builds the Yahtzee executable when make is run with no arguments or with target Yahtzee. Your makefile must assume that the code in /c/cs427/hw5/Required has been copied to the current directory; do not hard-code that particular directory in your makefile.