next up previous contents
Next: Game Over Up: The buttons function Previous: Starting the game

Playing the game

Playing is easy. The Mines datatype needs not to be explained right now, suffice it to say that it models the state of the playing field (including the mines, but also keeping track of which fields have been explored or flagged). To play with a set m of mines means to execute these steps over and over again:

playOn takes care of the smiley when we (de)flagged or explored a field. It also checks wether we have won with the previous move; this is the case if there are no untouched fields left (i.e. all fields are either cleared or flagged). This works because we are only allowed to drop as many flags as there are mines on the field.

Christoph Lueth
Wed May 29 13:20:38 MEST 2002