FontysICT-sem1

Training - Dices and Randomness

If you want to program a game, even the simplest games (tic-tac-toe) encounter the problem: how do I program randomness? How do I make a random move? How do you program that?

To experience this, you will write a small program that simulates the random behavior of a dice. If this so-called “proof-of-concept” program works, you will have a better understanding of how to consider the necessary randomness during design and have more certainty about the game’s chances of success.

Assignment

Create a user interface with 6 picture boxes and a button that looks like this: ![[Dobbelsteen-ui.png]]

There are six objects of type PictureBox and a “Roll dice!” button on the form. The PictureBox objects are all invisible when the program is running (the Visible Property is set to false).

The goal is that every time the “Roll dice!” button is clicked, exactly one random PictureBox becomes visible. The other picture boxes become invisible. Program this functionality.

Extensions

Checklist

If you have completed the assignment correctly, you have met the following points:

Resources