Application Kata „Minesweeper“

Write a program that creates a cheat sheet for a given minesweeper game.

Minesweeper is a game that was originally part of the Windows operating system installation. The goal of the game is to open all fields that don’t contain mines without hitting a field with a mine underneath. If a field with a mine is clicked the game is over. Each field that is opened shows a number that depicts how many mines are in the neighborhood of the field.

The program you have to write has to create a cheat sheet that shows the number of mines in the neighborhood of each field.

An input file looks like the following example:
You call the program like the following:
C:> cheatsheet field1.txt cheat1.txt
The resulting file cheat1.txt has the following content:
A further example for input and output of the program:
**... **100
..... 33200
.*... 1*100
The minefield may vary in the number of lines and the number of columns. Input files are correct formatted so you don’t have to implement an error handling.

Level of difficulty

Code Kata Categroies