The complete specification of assignment #5 can be found as part of the stream at iTunes.
Because this assignment is meant to teach arrays it uses them heavily. Thus create arrays to hold the values of the last roll of dice, to hold the categories which have already been used, and to hold to total and the sub scores. Because they are needed in several methods create them as instance variables. The dice array is filled with each (first) roll thus it can be initialized with the declaration. The others are instancialized and thus reset starting a new game. The array holding the used categories differs from the others as it is two dimensional where the rows represent the player and the columns the selected category.
The game itself consists of a fixed number of rounds which equals the number of scoring categories. In every round each player has a fixed number of rolls where the first one differs slightly from the following as all dice have to be rolled. After a players turn his/her score has to be updated, and at the end of the game the winner has to be selected.
Continue reading “cs106a – Assignment #5”