

Contents = Mine then Result := Result + 1 end if end if - X+1:Y if Item ( X + 1, Y ). Contents = Mine then Result := Result + 1 end if end if - below of X:Y if Y Item ' First ( 2 ) then if Item ( X + 1, Y - 1 ). Contents = Mine then Result := Result + 1 end if - below X-1:Y if Y Item ' First ( 2 ) then if Item ( X, Y - 1 ). Contents = Mine then Result := Result + 1 end if end if - X-1:Y if Item ( X - 1, Y ). With _Random with Ada.Text_IO procedure Minesweeper is package IO renames Ada.Text_IO package Nat_IO is new IO.Integer_IO (Natural ) package Nat_RNG is new _Random (Natural ) type Stuff is ( Empty, Mine ) type Field is record Contents : Stuff := Empty Opened : Boolean := False Marked : Boolean := False end record type Grid is array ( Positive range, Positive range ) of Field - counts how many mines are in the surrounding fields function Mines_Nearby ( Item : Grid X, Y : Positive ) return Natural is Result : Natural := 0 begin - left of X:Y if X > Item ' First ( 1 ) then - above X-1:Y if Y > Item ' First ( 2 ) then if Item ( X - 1, Y - 1 ). 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. 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.
#Minesweeper java free


