Modded (again) by Sobriquet and re-licenced as GPL v1. Modded by Sobriquet and re-licenced as CeCILL v2 Gui clone w/o graphic files but with cheats. ( "Solution: (+ = correctly marked, - = incorrectly marked)" ) Mark (Item => The_Grid, X => Chosen_X, Y => Chosen_Y ) While not Finished and Count_Marks (The_Grid ) /= Bomb_Count loop Height ) īomb_Count : Positive := Width * Height * 20 / 100 Procedure Set_Bombs (Item : in out Grid Max_X, Max_Y, Count : Positive ) is Opened andĬlear_Neighbours (The_X + 1, The_Y - 1 ) Opened andĬlear_Neighbours (The_X - 1, The_Y - 1 ) If Mines_Nearby (Item, The_X, The_Y ) = 0 then only proceed if neighbours don't have mines Procedure Clear_Neighbours (The_X, The_Y : Positive ) is clears the neighbours, if they don't have mines clears a field and it's neighbours, if they don't have mines Procedure Mark (Item : in out Grid X, Y : in Positive ) is counts how many mines are in the surrounding fieldsįunction Mines_Nearby (Item : Grid X, Y : Positive ) return Natural is Type Grid is array (Positive range, Positive range ) of Field Note: Changes may be made to the method of clearing mines to more closely follow a particular implementation of the game so long as such differences and the implementation that they more accurately follow are described.Īda with Ada. You may also omit all GUI parts of the task and work using text input and output. The Task is to create a program that allows you to play minesweeper on a 6 by 4 grid, and that assumes all user input is formatted correctly and so checking inputs for correct form may be omitted. You win when you have correctly identified all mines.Of course you lose if you try to clear space that has a hidden mine.
#HOW TO PLAY MINESWEEPER GAME FREE#
#HOW TO PLAY MINESWEEPER GAME WINDOWS#
You are initially shown all grids as obscured, by a single dot '.' A good example for a minesweeper game, is the one that ships with Windows (any version) a simple search for online minesweeper game will also direct you to several versions, which all have the same concept.The grid is shown as a rectangle of characters between moves.
Each mine occupies a single grid point, and its position is initially unknown to the player.The total number of mines to be found is shown at the beginning of the game.The top left of the grid is position 1,1 the bottom right is at n,m. Positions in the grid are modified by entering their coordinates where the first coordinate is horizontal in the grid and the second vertical. There is an n by m grid that has a random number (between 10% to 20% of the total number of tiles, though older implementations may use 20%.60% instead) of randomly placed mines that need to be found. You are encouraged to solve this task according to the task description, using any language you may know.