Minesweeper In Java

Minesweeper is a classic video game created in 1990’s., The goal of this game is to find all the squares which dont have mines underneath. 

Output of this Java Program – Screenshot:

The game is designed with the logic of each squares or cells have following rules.

Each square may be any one of the following:

  • Contains a Mine which will explode and end the game, when uncovered.
  • Contains an empty cell, which can be uncovered or not.
  • Contains a number, which is the count of all the mines adjacent to it.

If the player clicks on the mine, the game ends.  

The following is the implementation in Java of Minesweeper game, can be directly run in any version of Java greater than 1.4.

Note: Please include the jpg/png files in appropriate location as mentioned in the java code, to see your Minesweeper game working fine. 

InitScreen.java

Driver.java

You may also like...

2 Responses

  1. can someone help me out to find this error

    “F:\11>javac Driver.java
    Driver.java:3: error: cannot access InitScreen
    InitScreen intzeScrn=new InitScreen();
    ^
    bad class file: .\InitScreen.class
    class file contains wrong class: my.test.InitScreen
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    1 error””

  2. admin says:

    Hi,
    Please remove the package in the InitScreen Class.,
    And run the Driver.java class again.,
    It will run..,

Leave a Reply

Your email address will not be published. Required fields are marked *