Skip to content

This is an implementation of a MineSweeper in java created for the lecture "Einführung in die Software-Entwicklung".

Notifications You must be signed in to change notification settings

egrund/java_MineSweeper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

java_MineSweeper

This is an implementation of a MineSweeper in java created for the lecture "Einführung in die Software-Entwicklung".
Author: Eosandra Grund
Date last modified: 31.07.2022
Play by navigating to the bin folder and executing:

java mineSweeper.main.MineSweeper

Game Mechanics

  • You can uncover a field using the left mouse button, it then shows the amount of neighboring bombs. If it was a bomb you lose and the game ends. If it does not have a neighboring bomb, all the neighbors are uncovered as well (recursively).
  • If you think there is a bomb in one field, you can use the right mouse button to mark it. When it is marked it cannot be uncovered, but you can remove the mark by clicking the right mouse button again. If you uncovered all the fields without bombs, you win the game.

A screenshot of playing the game


Picture 1: The View of a running game with 10x15 fields and 15 bombs. Marked fields have a "!".

Model-View-Controller-Pattern and Observer-Pattern

I implemented the game using the Model-View-Controller-Pattern. The game and all the game mechanics are in the model containing the classes game and field. The controller contains all the controls and sends them to the model. The view creates the visuals using Swing and is also an observer of the model so it can change the view depending on the changes in the game. The Observer-Pattern is implemented using java.beans.PropertyChangeSupport.

Execution

  1. Navigate to the bin folder.
  2. Play by executing:
java mineSweeper.main.MineSweeper

Which creates a default game with 10x10 fields and 10 bombs.

  1. Or try your own combinations of sizes and bombs by using
    java mineSweeper.main.MineSweeper (x_dim y_dim (number_bombs)).
    This could for example result in
java mineSweeper.main.MineSweeper 5 15

which creates a game with 5x15 fields and 5*15 / 10 = 7.5 ~ 7 bombs,
or in

java mineSweeper.main.MineSweeper 10 15 15

which creates a game with 10x15 fields and 15 bombs

About

This is an implementation of a MineSweeper in java created for the lecture "Einführung in die Software-Entwicklung".

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages