Explained the concept of an animation loop:
- That continues to iterate until the user takes some particular action:
- Such as pressing the Esc key.
Introduced you to the pseudo-random number generator function named rand.
Showed you how to use rand to:
- Obtain an approximately uniformly distributed series of values:
- That fall between a specified lower and upper bound.
Showed you how to seed the random number generator with the current time.
Seeding with the time:
- Causes rand to return a different sequence of pseudo-random
- Each time the program is run.
Showed you how to cause a ball to move at a constant speed in one of four
directions in a box.
Showed you how:
- To detect a collision with a wall, and
- To bounce off the wall in a randomly-selected direction.