Mine Picker

Recommended levellevel
About 10 years ago, an omen appeared in offices everywhere: if an employee is staring too intently at his screen and occasionally clicks with the mouse with the same intensity, he's most likely playing Minesweeper. For anyone who has forgotten, and for others who missed this era due to their age: Minesweeper is one of the most popular office games that shipped with Microsoft Windows. Even today, if you're sitting at a computer running this operating system, Minesweeper is either pre-installed (just type "Minesweeper" in the Windows search box) or you can download it free from the Microsoft Store. Many Linux builds, such as KDE and GNOME, also acquired similar games. Unlike most other "time killers", this game presents the perfect balances of logical moves and random moves, making Minesweeper very exciting and simultaneously... somewhat less pointless than other such games. So, we have a game board divided into squares. Some of them contain "mines", but we don't know how many there are or where they are. Our goal is to reveal all of the unmined squares without getting blown up. You reveal a square with a left click. If it doesn't contain a mine, then a number appears that represents the number of mines adjacent to the revealed space. Now you need to do some thinking and guess which cells can be revealed and which should be marked as mined. And so it continues until you win or explode. Windows developers created this toy to help humans learn to use the mouse (yes, there was a time when computers didn't have mice and you had to be content with just the keyboard). Actually, the history of Minesweeper stretches farther back than even Microsoft. Its predecessors were available on mainframes as early as the sixties of the last century… But we digress... Right now, we're talking about creating our own version of Minesweeper! The rules for our "probabilistic brainteaser" will be exactly those described above. We've already divided this difficult task into subtasks on CodeGym and we'll tell you what to do. Be brave.
Comments (17)
  • Popular
  • New
  • Old
You must be signed in
GCPixLevel 9 , Glasgow
yesterday, 08:39
I really like this because I can start to build something and sort my errors out but can I make a suggestion that you allow us to see previous requirements and instructions. It is helpful when you are further in and trying to remember what something was actually doing.
Tayyab MughalLevel 1 , Gujranwala
yesterday, 08:20
package com.codegym.games.minesweeper; import com.codegym.engine.cell.*; public class MinesweeperGame extends Game { } giving me error that the minesweepergame class must have a statement that imports the entire contents of the code.gym.engine.cell pakage. someone please help
IvanNikLevel 15 , Sofia
yesterday, 08:11
And how am I suppose to use setCellColor method ??? Something like that gameField[y][x].setCellColor(x, y, Color.ORANGE); ?
GCPixLevel 9 , Glasgow
yesterday, 13:55
just setCellColor(x,y,color). the x and y are the coordinates for the grid. You aren't assigning anything to the object so don't need the first bit
GCPixLevel 9 , Glasgow
yesterday, 07:46
Is there a way to go back to previous requirements? I have just restarted from the beginning so that I can read something in a previous step.
MixanJLevel 5 , Minsk
Saturday, 07:52
Can not publis game. Unknown status of publishing
MateoLevel 22 , Zagreb
Friday, 17:23
Can somebody explain the last condition in part9? FIRST - In the openTile(int, int) method, if the element is not a mine and has no mined neighbors, the openTile(int, int) method must be called recursively on each neighbor that hasn't been revealed. LAST CONDITION - The openTile(int, int) method must not call anything if the element is not a mine and has no mined neighbors. Use an empty string.
YannickLevel 4 , Antwerpen
Friday, 10:02
) There is a setScreenSize(int, int) method to set the size of the field 2) This method takes width and height arguments (the number of cells wide and high) 3) the dimensions of the field will be used frequently, so it's convenient to put them in a constant named SIDE 4) the result should be a call like this: initialize method() 6) this means that the initialize() method must be declared in the MinesweeperGame class
package com.codegym.games.minesweeper;

import com.codegym.engine.cell.*;

public class MinesweeperGame extends Game  {

public final void setScreenSize(9,9);

I don't need the solution. I just need to know what these instructions mean... Whenever I look up a constant I get other results than what's necessary here so I finally found and I believe a constant is just a value that doesn't change so I'm assuming a public final void? As void sets the screen size. And so far I've learnt that if a method "does" something it should be void. Can anyone help me out with research.?
季军Level 14 , Shanghai
Thursday, 13:37
What does "openTile(int, int) method must not do anything" mean? I am stuck in this task...
zhaoyangLevel 22 , Los Angeles
Thursday, 23:54
bro, if you need help, you better give more information
MateoLevel 22 , Zagreb
Sunday, 02:43
it means the tile should NOT have 0, but an empty string. Condition is unclear i feel you
Harvey RobertsLevel 8 , Helsinki
Thursday, 09:47
This is what i have... package com.codegym; import com.codegym.engine.cell.*; public class MineSweeperGame extends cell{ }
AbrahamLevel 18 , Watsonville
Friday, 01:10
You need to extend 'Game' from the cell package.
Harvey RobertsLevel 8 , Helsinki
Thursday, 08:42
This is infuriating.......... I have imported the game.cell.*; and extecded it in the class yet it will not compile. it shows an error that is beyong reasoning. I'm getting annoyed!
Jorge SosaLevel 20 , Madrid
Thursday, 09:33
Does your import statement look like this? It should work. import com.codegym.engine.cell.*;