Real minefields are terrible things. Soldiers bury bombs in the ground. Real people, often long after the battles are over, step on the mines. Many are killed or are horribly injured. Mine disposal experts are needed to find and remove mines from the fields.
Can you represent this situation in a spreadsheet?
This will require you to take an Information Technology point of view of minefields. You will need to consider, for example, how information is inputted, stored, processed and outputted, then make a working “model”, bit by bit.
To keep things simple, let’s make this area a 5x5 array of cells and represent the steps as “1’s” placed in cells.
Their locations can also be represented as “1’s” placed in another 5x5 grid.
This can be shown on another 5x5 grid filled with formulae that give a result if there are “1’s” in similar positions in the both of the first two areas.
Spreadsheets allow us to check for special situations with an IF function. If we were using Microsoft Excel, for example, we might place this formula in cell N2
=IF(B2+H2=2,9,” ”)
[If the sum is 2, the cell shows a “9”, if not, the double quotation marks make the cell appear empty.]
We can then use AutoFill to place similar formulae in the rest of this area.
The “9”, in this case, represents an explosion, but not very dramatically. So we can add another IF function formula under the first area to make this event more explicit, for instance:
Once you have checked that this is all working the way you expect it to, you can work on how to make bigger minefield areas and how to hide the second and third areas from the players’ sight.
PART TWO
To help them locate and remove mines from minefields, mine disposal experts use mine detectors. These detectors collect harmless but useful information from the areas near mines. We can build on our basic game to represent this.
Let us first provide another 5x5 grid that collects and processes some mathematical information from all parts of the “minefield”.
Each cell in this new grid could contain a formula calculating the sum of the “1’s” in a 3x3 area immediately around each cell in the “minefield”.
In this case, we might place a formula like this in cell H10:
=SUM(G1:I3)
Again, AutoFill can be used to place similar formulae in the rest of this area.
When we walk through a minefield with a mine detector, it only reveals information about the area immediately near us.
Suppose we create another 5x5 area to show this.
Again, another IF function formula will do the trick. For example, in cell B10 , we could place the formula
=IF(B2=1,H10," ")
Then we could use AutoFill to place similar formulas in the rest of this area.
PART THREE
The next step might be to provide a way players can “dispose” of mines.
One way of doing this could be to give them the option of placing another number besides “1” in cells where they guess a “mine” is located.
You could then use IF function formulae to give them feedback about whether their guess was correct.
I will leave that task up to you.
Is there anyone out there ready to take up this challenge?
No comments:
Post a Comment