This chapter includes an application of inheritance in JavaScript.

Cast the die!

This is a game for two(or more) players. In any game the die can be cast up to 6 times. After any cast you, and your opponent, must decide whether to 'take the money" (the value of the cast) or stay for the next cast (if there is a cast remaining). Keep casting until both you and your opponent have 'taken the money' (or no cast remains). We wish to ransform this into a game between a human and a computer.

Play the game in two versions:-

Study the source-code in this implementation to see how to introduce inheritance.