Creating the empty field

The very first step in the development of a Minesweeper game is the creation of the empty field where mines will be placed.

The idea: As seen in the Concentration game, an array is the best way to represent a set of elements such as cards or tiles, so we'll be using an array. At this time, we have two options. Look at the picture (using a 4x4 field for the sake of simplicity):

Creating the empty field

On the left, a representation of the field as an array of tiles, just like the one used in the Concentration game. Each tile is represented by an index from 0 to 15. On the right, it's the same field represented by an array in which each row is an ...

Get Flash Game Development by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.