Skip to content

Every week we conduct 4-6 hours hackathon and develop applications that are in the market with approach towards being more Object Oriented and Clean Coding

Notifications You must be signed in to change notification settings

ClouderaSolutions/MineSweeper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MineSweeper

Design a minesweeper game of N*N grid

Some randomly-selected squares, unknown to the player, are designated to contain mines. On each turn, the player has to select a square (x,y) by indicating if it contains a mine(flagging) or if it is safe, thereby opening it. If the square containing a mine is revealed, the player loses the game.

If it does not contain a mine, a digit is instead displayed in the square, indicating how many adjacent squares contain mines;if no mines are adjacent, the square displays '0'.

Two squares are adjaecnt to each other only if they share at least one side. Sample input: Enter the minefield layout: xxm, xmx, xxx (This represents a 3*3 minefield with mines located in 1,3 and 2,2 locations.

The program should then display the grid as shown below with all squares concealed.) xxx xxx xxx Enter option:o(0,0) (open location (0,0). The program should then display) 0xx xxx xxx Enter option:o(0,1) (open location (0,1). The program should then display) 02x xxx xxx Enter option:f(0,2) (open location (0,2). The program should then display) 02f xxx xxx Enter option:o(1,1) (open location (1,1). The program should then display) 02f xmx xxx Oops! You stepped on a mine! Game over!

If the player opens all the locations that do not have mines, the player wins the game. In such a case, the output will be shown as below 02f 1f2 010 Wow! You cleared the minefield! Game over! Note that the player has to open all locations that do not contain a mine.

If some squares are flagged but do not contain a mine, he still has to continue and open the squares that don't have mines. If he requires, he can open a location that has already been flagged.

Extension: Allow a player to "clear around" a revealed square once the correct number of mines have been flagged around it.If the player does this before identifying all mines around the square the user could lose the game if an adjacent square contains a mine.

About

Every week we conduct 4-6 hours hackathon and develop applications that are in the market with approach towards being more Object Oriented and Clean Coding

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages