HTML and CSS Reference
In-Depth Information
Figure 2-1.
First throw, resulting in a loss for the player
It is not apparent here, but our dice game application draws the die faces each time using the
canvas
tag.
This means its not necessary to download images of individual die faces.
A throw of two 1s means a loss for the player since the rules define 2, 3, or 12 on a first throw as a loss.
The next example shows a win for the player, a 7 on a first throw, as shown in Figure 2-2.
Figure 2-2.
A 7 on a first throw means the player wins.
Figure 2-3 shows the next throw—an 8. This is neither a win nor a loss, but means there must be a follow-
up throw.