public class DiceGame {
protected Dice dice;
public DiceGame(Dice theDice) { dice = theDice; }
public void Play() { // TBD
int total = dice.Roll(); rolling all the dice at once
int total = dice.Roll(3); rolling 3 dies
// indexer allows individual Rolls.
int firstDieRoll = dice[0].Roll();
int secondDieRoll = dice[1].Roll();
// when I don't care how many there are
for (int i=0; i<dice.Count; i++) {
dice[i].Roll();
}
}
}
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/