Throw of the dice

The dice program, version 2.

 

Instead of inputting the dice values via the scrollbars, we will change the program so that the computer decides the die values randomly. We will create a button, labelled 'Throw'. When it is clicked, the program will get two random numbers and use them as die values.

Creating random numbers is a very common thing to want to do in game programs of all kinds. If the game behaved the same way every time u played it, it would be very boring. Randomness creates variety, whether it is the arrival of aliens, the bounce of a ball or the layout of a maze.

Hosted by www.Geocities.ws

1