Giter Site home page Giter Site logo

java-minesweeper's People

Watchers

 avatar  avatar  avatar  avatar

java-minesweeper's Issues

Best Times should not be resizable

Currently, if an extremely long name is put in for best times, it elongates the window to try to fit the whole thing in. A side-effect of this is that when the scores are reset while viewing an elongated window, the window still stays with the larger size.

An extremely long name should instead flow off the end of the window and be partially invisible, such as visible here (original WinXP minesweeper running on Linux, so theme is a bit off):

image

Halt the game upon end of game

Disable the events of mouse clicks except for on the face button when an end-game condition is reached:

  1. All non-mine Cells opened; or
  2. A mine Cell has been opened

Chording should "press" surrounding unopened cells

2018-09-26_13-04-53

Idea: if detecting that chording is happening, loop through unopened neighbours, change their image
If the mouse leaves the current cell, unpress the neighbours
If the mouse enters a cell, and is chording, press the neighbours

Potential problem: like the cascading "opens" and mine reveals (as in #13) this may cause the cells affected by both the leaving and entering step to become unpressed and pressed again.

Theme changing

Some option under the Game menu to allow the user to choose a theme.
The theme is a folder containing icons for each tile and face icon. Possibly include different counters, too (number of seconds passed and number of mines remaining).

Idea: Game -> Theme chooser ->

  • Either browse for a folder or
  • Automatically detect available themes based on scanning the directory for appropriate files and display these as a submenu option. Perhaps replace the Colour radio menu item

CellImpl make use of Persistence

0ef9a22: "need to have a way for cellimpl to refer to persistence.getMarks()"

Because right now it hardcodes all Cells to have marking as true, regardless of what has been loaded from the database (from #19). This causes the marking status to be out of sync with the menu options.

GamePanel has direct access to a Minesweeper object, which can in turn access the Persistence object. This may be bad programming, but may be how CellImpl can do this.

Need to think of a better way to have Persistence access.

Expand on readme

Add more detail into the readme, such as details on what this program does/aims to achieve, other modifications I have, requirements to compile/run the program, etc.

Maybe also have a list of upcoming features that is updated with each commit.

Might be a good idea to have screenshots or a gif displaying the product.

Create custom border class

Java's in-built bevel border defaults to single-pixel width with no way to customise this.

See this SO post for something similar to what I want.

The border style of the elements looks like this:
expected-bevel

Also note the diagonal ends of the borders: the far bottom-left (and top-right) corners are not the same colour as the main part of the border. They are a separate colour. In this case, all (192, 192, 192).

Opening many cells at the same time repaints them individually

At the moment, opening many cells at the same time repaints them individually, which gives a
bit of a "cascade" effect, as seen in the following .gif
2018-09-22_00-03-23

See if there is something that can be done to remedy this
Perhaps using bfs instead of dfs
Or using a flag to only visually open them once they are all opened
Or maybe not repainting till they're all done

GameIO interface

Having a way to build and/or write a minefield

Can be used for automated and non-automated testing by allowing for specific contrived situations.

At the very least must take the x and y dimensions of the board and the number of mines.
That way, it can correctly throw exceptions if any of the above is an impossible situation (e.g. all cells are mines, map too small, ...)

could have something like:

  • read an exact representation of the board (which cells have mines, which ones are open, etc.)
  • only read the location of mines

Probably requires some refactoring of GameImpl by shifting functions around and extracting some functionality into helpers

This interface should pave the way to unit testing capabilities

Click face to restart game

The beginning and end of the press/release cycle must be done on the face for the game to restart

  • If the mouse enters the face, presses, leaves, and releases, nothing happens
  • If the mouse enters, presses, leaves, re-enters and releases, the game also resets
  • If the mouse is NOT over the face, presses, enters the face and releases, nothing happens

bad custom fields should default to beginner values

in Minesweeper.rbMenuItem.addActionListener, entering a bad input for heightField, widthField or minesField (e.g. empty strings, non-numerical input, etc.) should result in beginner values for each incorrect field.

2018-12-01_18-31-29

          try {
            newHeight = Integer.parseInt(heightField.getText());
          } catch (NumberFormatException ex) {
            newHeight = 9;
          }
          try {
            newWidth = Integer.parseInt(widthField.getText());
          } catch (NumberFormatException ex) {
            newWidth = 9;
          }
          try {
            newMines = Integer.parseInt(minesField.getText());
          } catch (NumberFormatException ex) {
            newMines = 10;
          }

This requires an individual try/catch since each field is treated individually

Best times

Each preset difficulty (beginner, intermediate, expert) should have a corresponding best time and name (default: 999 seconds) which can be found under the menu Game -> Best Times ....
Exploring this window should yield a window like this:
Best times screen

This issue has two parts:

  • Displaying the Fastest Mine Sweepers window, and
  • Creating some mechanism by which fast times (upon game wins) are recorded somewhere and then displayable

The latter of which includes checking for fast win times and prompting the user for a display name, which looks like this:
New best time prompt

  • Best time names may include symbols, numbers, letters, etc.
  • The window size for best times is fixed - it doesn't expand or contract with short names

save settings to database

things to store might include:

  • marks
  • colour
  • sound
  • previous difficulty setting
    • and x/y/mines for custom difficulty, too
  • screen position
  • best times and names -> probably use a separate db table for this

this issue should handle saving these and loading them upon creating a new game

Auto-flag all un-flagged mines upon completion

When the game is won (all non-mine Cells opened), every mine square should be automatically flagged.

Likely just use a aggregate operation pipeline to go through each Cell -> if is a mine and is not flagged -> flag it.

Extract some constants out to a constants class

This should reduce the amount of hardcoding scattered throughout the codebase.

Some examples include:

  • the various difficulty values (x, y, mines)
  • the minimum and maximum game values (x, y, mines), with the exception of max mines, since that is calculated at the runtime from the given x and y
  • maximum number of seconds

GUI resizes upon new game

Looks like the grid alignment changes and each CellIcon is 1 pixel shorter both horizontally and vertically.
First game is fine, but every subsequent game is slightly smaller than the first.

Possibly something to do with the way Minesweeper.resetGame() rebuilding things

Left+right clicking should expand like middle click

Some notes on behaviour:

  • this should only trigger the opening of neighbours if the number of adjacent flags is equal to the cell's number, AND

  • this should trigger if both left and right mouse buttons are down and one of them is let go

  • this is still valid if both left and right leave the intended CellIcon and return over it again

Rough plan:

  • record left/right is down upon mouse press
  • record left/right is up upon mouse leave
  • record left/right is down upon mouse enter if it is still down
  • trigger open surrounding upon left/right release if the other is still down

Clicking in the game makes face surprised

make the face surprised ๐Ÿ˜ฎ when left or middle clicking anywhere in the game

This might be quite tricky since the face changes on any click in the game, even on the cells or on the face itself (middle click)

Safeguard first click

If first click was going to be on a mine, move the mine to the top-left corner.

If the top-left corner already has a mine, move it to the right one square. Repeat until there is a safe square that can become a mine.

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.