java.lang.Object
app.minesweeper.Minesweeper
- All Implemented Interfaces:
Game<MinesweeperMove,
,MinesweeperPiece> GameView<MinesweeperMove,
MinesweeperPiece>
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns all pieces in the gamegetLegalMoves
(int player) Returns list of moves available for the playergetLegalMoves
(int player, MinesweeperPiece piece) Returns list of moves with given piece available for the playergetPieces
(int player) Returns all pieces that belong to the playerint
Returns number of player this game requiresgetState()
makeMove
(int player, MinesweeperMove move) Makes the move as the player(package private) int
minesAround
(MinesweeperPiece piece) (package private) List<MinesweeperPiece>
surrounding
(MinesweeperPiece piece) (package private) List<MinesweeperPiece>
uncover
(MinesweeperPiece piece) Uncover the piece and surrounding area if there are no mines around(package private) void
uncoverSingle
(MinesweeperPiece piece) Uncover just this piece without checking surroundings(package private) List<MinesweeperPiece>
uncoverZeros
(MinesweeperPiece piece) (package private) boolean
won()
-
Field Details
-
lost
boolean lost -
pieces
Map<Field,MinesweeperPiece> pieces -
mines
-
-
Constructor Details
-
Minesweeper
public Minesweeper()
-
-
Method Details
-
makeMove
Description copied from interface:Game
Makes the move as the player- Specified by:
makeMove
in interfaceGame<MinesweeperMove,
MinesweeperPiece>
-
uncover
Uncover the piece and surrounding area if there are no mines around -
uncoverSingle
Uncover just this piece without checking surroundings -
uncoverZeros
-
surrounding
-
minesAround
-
getPieces
Description copied from interface:GameView
Returns all pieces that belong to the player- Specified by:
getPieces
in interfaceGameView<MinesweeperMove,
MinesweeperPiece>
-
getAllPieces
Description copied from interface:GameView
Returns all pieces in the game- Specified by:
getAllPieces
in interfaceGameView<MinesweeperMove,
MinesweeperPiece>
-
getLegalMoves
Description copied from interface:GameView
Returns list of moves available for the player- Specified by:
getLegalMoves
in interfaceGameView<MinesweeperMove,
MinesweeperPiece>
-
getLegalMoves
Description copied from interface:GameView
Returns list of moves with given piece available for the player- Specified by:
getLegalMoves
in interfaceGameView<MinesweeperMove,
MinesweeperPiece>
-
won
boolean won() -
getPlayerCount
public int getPlayerCount()Description copied from interface:GameView
Returns number of player this game requires- Specified by:
getPlayerCount
in interfaceGameView<MinesweeperMove,
MinesweeperPiece>
-
getState
-