Giter Site home page Giter Site logo

java-minesweeper's Introduction

java-minesweeper

A Java version of Microsoft XP Mineseweeper. The GUI is built using Java AWT and Swing, with the sound component using JavaFX. This may be ported to JavaFX in the future.

Requirements

  • Java 8 or higher
  • JavaFX

Running

  • git clone [email protected]:Namdrib/java-minesweeper.git or git clone https://github.com/Namdrib/java-minesweeper.git

Command line

  • cd java-minesweeper/src/minesweeper
  • javac Minesweeper.java
  • java Minesweeper

IDE

  • Import folder as a project and compile/run

How to play Minesweeper

Playing a game

  • Click on a tile to reveal it. Its number (1-8) represents how many mines are adjacent to the tile
    • If it doesn't have a number, there are no mines surrounding it, and it will automatically reveal its neighbours
    • If it contained a mine, the game is lost
  • Right-clicking on a tile flags it - this is useful for marking the position of known mines
    • If enabled, right-clicking again on a flagged mine puts ?, which may be useful for if the player is unsure whether there is a mine
  • Left-and-right clicking at the same time on a numbered tile allows the user to perform a chording action
    • Chording only takes place if there are the same number of flags around the tile as its displayed number. For example, to chord a "1" tile, there must be exactly 1 flag around it
    • Chording opens every un-flagged neighbour of the target tile, which allows for rapid board expansion
    • If one of the flags around the neighbour is incorrectly placed, this results in the opening of a mine, resulting in the game being lost
    • The user may also middle-click the tile to achieve the same effect

Changing the settings

There are several settings that may be changed from within the game

  1. The difficulty
    • There are three preset difficulties, beginner, intermediate and expert
    • In addition to these, there is also a custom difficulty in which the user may select the board's dimensions and how many mines there are. Note that the x-dimension must be between 9 and 30, the y-dimension must be between 9 and 24, and the number of mines must be between 10 and (x-1)*(y-1)
    • High scores are maintained for the three preset difficulties
  2. Marking: whether tiles may be marked with a ?
    • Turning this off may improve performance for speedruns
  3. Theme: which graphical theme to use (work in progress)
    • At some point in the future, I may implement a theme switcher, where the program scans through its directory to see whether a valid theme is present
    • For a theme to be valid, it must have all the files in /assets/img but in another folder (e.g. /assets/img/ex_theme). Then in the game, the user may use the menu File -> Themes -> ex_theme to switch themes. Doing so will only affect the icons that are being displayed, not the colours of the main window, borders, etc.
  4. Sound: whether sounds are to be played

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.