Game Development Reference
A correctly initialized minefield after the first click.
If you have not been doing so regularly, now is a very good time to open the
File menu and choose Save All. Note that starting the debugger saves the files
as well as providing you a chance to see if this works. Start your application
in the debugger. Click the Expert button and, once the field paints all of the
tiles, click one of them. The results you see should resemble Figure 4.3. The
hard work is paying off—this looks like a Minesweeper minefield!
Take the time to carefully evaluate each square of your own running game.
Are all 99 of the mines there? Noting that blanks imply zero, does every square
that does not have a mine have the right number? If these numbers are not
correct, both human and AI players will have a very frustrating time with your
Making It Playable
Our next step is to turn what we have into a playable game. First, we must turn off
the debug code that sets the text of the Square objects. That was in two places in
the Square class. Comment out the debugging sections in Init and Increment .
Run the game and click a tile to make sure.