Modified on Thursday, 31-Jan-2002 12:47:32 MST.
This set of exercises will guide you through making a simplified version of the Minesweeper game popularized by the Windows operating systems. This example is intended to teach object oriented concepts, though not design methodology.
The technique we'll use to build this simplified version requires separating the game logic from the presentation. We'll focus on modelling the game first, then move on to its presentation. This is the first exercise that will use objects and relationships between objects.
Start off by brainstorming. Play the Minesweeper game. Look at the elements in the game, and make a list of all the nouns.
Objects consist of properties, methods, and events. We'll first concentrate on properties and methods, and leave events for later.
We are going to start by focusing on the squares. What can you do to a square? What operations can you perform on it?
What *states* can a square be in? Which states really make a difference in the game, and which ones are just for display purposes?
Make a diagram of the states for a single square, and what happens to make it transition between the different states. (Note that what happens to it is usually the actions that you came up with in Exercise 2.)
An example of a state transition diagram:
States are usually defined by one or more variables.
... in progress ...