Week 10: Exercises

1. Drawing Rectangles

Write a GTK or Windows Forms application that lets the user draw rectangles by clicking and dragging the mouse. Each rectangle should have a random color. If the user clicks on an existing rectangle, they can drag it to a new position, and it should rise to the top of the Z-order.

2. Bouncing Ball

Write an application that displays a bouncing ball. The ball should lose a bit of velocity each time it hits the ground, so that it eventually comes to a stop.

3. Bouncing Balls

Extend the previous application so that the user can create new balls by clicking the mouse. Each ball should have a random size and color. All the balls should bounce simultaneously.

4. Tic Tac Toe

Here is an implementation of Tic Tac Toe with a text-based user interface. Study it to understand how it works. Build a graphical interface to the game.

5. Simon

Implement the game of Simon.