Before we have anything on which to work, we must have an actual mineField upon which to place out characteristics, definitions and values. Using Empirical Modelling as our means, a good approach here could be to keep it simple, and define the 'mineField' itself as a list of cells representing some X x Y board.
As we are creating quite a small initial model of the mineSweeper model, a suitable approach for such a game is a 4 x 4 playing area. Clearly, 3 x 3 is too small, and 5 x 5 and above start to increase the size of the modelling task beyond what is required to create a model that can cater for any sized board.
So, we may visualise a 4 x 4 mineField as being represented by a 16-element list in TKeden. In this fashion, when X=1 and Y=1, the cell number is mineField. Similarly, where X=3 and Y=2, we refer to mineField[((Y-1) x 4) + X], or minefield.
Begin a TKeden session, then type or copy & paste the following definition into the TKeden Input Window and select Accept :
Whilst no discernable output appears, we may interrogate TKeden using the ? operator typed into the TKeden Input Window thus :
mineField is [p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14 , p15, p16];
This query provides output on the xterm window used to start up TKeden concerning the variable, mineField.
With the mineField defined, it is useful to define a few characteristics which may be required after further additions are included to TK-MineSweeper. We can define the dimensions of the board, and the number of cells, easily, using a number of variables.
We may define the number of cells the board possesses as being the number of elements in the list, mineField. This can be achieved simply by using the TKeden operator, # as follows :
Here, the # operator returns the number of elements of the list, mineField, and stores it as nCells.
nCells is mineField#;
We may check the correctness of our current definitions by using writeln() statements from the TKeden Input Window as follows :
xDim is 4; yDim is 4;
In the current specification, xDim and yDim should both be 4, and nCells should be 16.
writeln("xDim=", xDim, " yDim=", yDim, " nCells=, "nCells");