Chapter 1. Making Fish Swim in the Multithreaded Aquarium
The Aquarium application.
This first project is purely for fun—a working, multithreaded aquarium where the fish actually swim around and bounce off the walls. We're going to create a dozen fish objects and turn them loose in the aquarium, where they're going to do their own thing as you'd expect fish to do.
You can see what the aquarium looks like in Figure 1.1; although you can't see the colors in the figure, the dozen fish are bright green and swimming at much the same speed that real fish would. When they hit the edge of the aquarium, they reverse direction, and every so often, they change ...