Mine Picker

Recommended levellevel
5+
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 (249)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Anonymous #11344047
Level 1 , Nigeria
15 May, 20:15


27 April, 14:46
/* Comment has been deleted */
27 April, 14:46
/* Comment has been deleted */
Anonymous #11268978
Level 1 , Lancaster, United States
28 January, 01:13
huh
Hoist
Level 22 , San Diego, United States
26 January, 06:14
Cool Section here ! Lucky pick vs Threading ! lol Just like the file scaffolding in JavaScript frameworks or Salesforce cloud platform to build out the different code containers -- and pulling in some pre-built functions and User Interface libraries to configure. ---> this thread is Great --- CG game development is a Hot topic !
Мирэвис Channel
Level 1 , San Francisco, United States
19 January, 11:52
package
com.codegym.games.minesweeper;
import
com.codegym.engine.cell.*;
public class
MinesweeperGame
extends
Game { }
Anonymous #11254523
Level 2 , Brno, Czech Republic
11 January, 14:20
Why it does not show the score?
Alex Agboola
Level 3 , Fraser, United States
8 January, 14:38
I'm confused when it says I should "inherit the Game class". What does it mean by that?
Hiyo Full Stack Developer
12 January, 13:05
Inheritance. You will have a sub / derived class called MinesweeperGame which will then inherit Game class. Inheritance is useful when you don't want to write repeating code or you have multiple classes that have similar logic and you want them all to inherit from a base class holding said logic. For this case, "Game" class holds various game logic that's useful for any kind of game. Snake, Chess, MineSweeper, Racing, etc. We can't see what "Game" class holds but the general idea is that they have things like timer ( graphics are rendered and re-rendered based on time [ animation, etc ] ), score ( every game has score too ), etc.
public class MinesweeperGame extends Game {
  Your logic goes here...
}
Hope this helps.
DoubleDude Android Developer at Microsoft
4 January, 23:17
same
Hoist
Level 22 , San Diego, United States
26 January, 06:53
Yo MS -- you stumbled into Sun Microsystems here ! C# on VS is great tooling lol
ping canda
Level 1 , Philippines
2 January, 14:48
im new here :)