Class MineSweeper

java.lang.Object
  extended byMineSweeper

public class MineSweeper
extends Object

An implementation of the Mine Sweeper game.

Version:
2003.12.02
Author:
Stephen Edwards (based on Grant Braught's original)

Constructor Summary
MineSweeper()
           
 
Method Summary
static void endGame()
          End the current game.
static void gameWasLost()
          End the current game, reveal the board, and show an appropriate message to the player.
static void gameWasWon()
          End the current game, reveal the board, and show an appropriate message to the player.
static int getLevel()
          Get the current game level setting.
static boolean isGameOn()
          Determine if this game is currently being played.
static void main(String[] args)
          This method allows the game to be run as a stand-alone java program.
static void makeNewBoard()
          Create a new board, using a size and number of mines determined by the current level setting.
static void reStartGameOnClick()
          Restart the current game.
static void revealBoard()
          Reveal the board.
static void setLevel(int newLevel)
          Set the level of this game.
static void startGame()
          Start playing the current game.
static void startGameOnClick()
          Start playing the current game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MineSweeper

public MineSweeper()
Method Detail

endGame

public static void endGame()
End the current game.


gameWasLost

public static void gameWasLost()
End the current game, reveal the board, and show an appropriate message to the player.


gameWasWon

public static void gameWasWon()
End the current game, reveal the board, and show an appropriate message to the player.


getLevel

public static int getLevel()
Get the current game level setting.

Returns:
the current level, using one of the predefined constants (MineSweeperMenuHandler.BEGINNER_LEVEL, MineSweeperMenuHandler.INTERMEDIATE_LEVEL, or MineSweeperMenuHandler.EXPERT_LEVEL)

isGameOn

public static boolean isGameOn()
Determine if this game is currently being played.

Returns:
true if this game is on

main

public static void main(String[] args)
This method allows the game to be run as a stand-alone java program.

Parameters:
args - the arguments provided on the command line, which are completely ignored by this program.

makeNewBoard

public static void makeNewBoard()
Create a new board, using a size and number of mines determined by the current level setting.


reStartGameOnClick

public static void reStartGameOnClick()
Restart the current game.


revealBoard

public static void revealBoard()
Reveal the board.


setLevel

public static void setLevel(int newLevel)
Set the level of this game.

Parameters:
newLevel - the game level, using one of the predefined constants (MineSweeperMenuHandler.BEGINNER_LEVEL, MineSweeperMenuHandler.INTERMEDIATE_LEVEL, or MineSweeperMenuHandler.EXPERT_LEVEL)

startGame

public static void startGame()
Start playing the current game.


startGameOnClick

public static void startGameOnClick()
Start playing the current game.