I. 358. In the minesweeper game one has to locate, or, more precisely, avoid, the \(\displaystyle K\) (\(\displaystyle 0\le K\le N\times N/2\)) mines on a board of size \(\displaystyle N\times N\) (\(\displaystyle 2\le N\le 50\)). The content of these \(\displaystyle N^2\) cells is initially hidden, but cells can be revealed by clicking on them. The game is immediately lost if we click on a cell containing a mine. Otherwise, a number between 0 and 8 is displayed in the newly discovered cell, showing the number of neighboring mines relative to this cell. If the newly discovered cell contains no mines, then all of its neighbors are automatically revealed, and this process is iterated by revealing the empty neighbors of the neighbors and so on. The game is won when all cells without mines are revealed.
The example shows one step of a game; ``Aktuális állás'' is the current position, ``A következő lépés'' is the next step, ``A rejtett aknák'' are the hidden mines, ``Sor'' is row and ``Oszlop'' is column.
Your program i358 should generate a mine field and play a game with the user.
1. Read the values of \(\displaystyle N\) and \(\displaystyle K\), then solve the following tasks.
2. Generate the board with \(\displaystyle K\) mines placed randomly: ``*'' denotes a mine, while ``.'' is an empty cell.
3. In order to test your program, one should be able to choose between Teszt (= test) and Játék (= game) modes. In the Teszt mode the mines should be visible, but in the Játék mode they should be hidden.
4. Read a valid row and column coordinate pair, then - based on the content of that cell - display an appropriate answer as follows.
\(\displaystyle a)\) If the selected cell contains a mine, then display Bumm! and stop the game.
\(\displaystyle b)\) If the selected cell does not contain a mine, then - by using the rules described above - display the current status of the revealed and still unknown cells.
5. The program should proceed and read the guesses until the user has determined the number of neighbors of all the empty cells. When this happens, the program should display a Nyertél! (= You won) message.
6. Before each user guess, your program should display the number of unknown cells and the number of the actual guess.
The source code (i358.pas, i358.cpp, ...) of your program with a brief documentation (i358.txt, i358.pdf, ...) of your solution should be submitted in a compressed file i358.zip, also specifying the developer environment to use for compiling your source.
Deadline expired on 10 December 2014.