public class GameModel extends AGameModel
setGame
to add the Game object to it.
Constructor and Description |
---|
GameModel() |
Modifier and Type | Method and Description |
---|---|
void |
addPlacement(Placement placement)
|
void |
continueGame()
sets to game state to RUNNING adds the time since the time was pause to pausedTime
|
void |
endGame(FinishedReason finishedReason)
sets the game to NOT_RUNNING and clears the placed
Placements |
Player |
getActivePlayer() |
int |
getCurrentRoundNo() |
int |
getCurrentTurnNo() |
FinishedReason |
getFinishedReason() |
Game |
getGame() |
GameState |
getGameState() |
Map<Position,Set<Gate>> |
getIllegalGates()
|
Position |
getNextTilePos() |
Placement |
getPlacementByPosition(Position position)
Returns a placement or null, depending on whether a tile is placed at the position passed
|
int |
getPlacementsCount() |
Iterator<Placement> |
getPlacementsIterator() |
long |
getTimePassedGame() |
long |
getTimePassedTurn() |
void |
increaseCurrentTurnNo() |
boolean |
isSetTokenTurn() |
void |
pauseGame()
sets the game state to PAUSED and saves the time that happened
|
void |
setActivePlayer(Player activePlayer) |
void |
setCurrentRoundNo(int currentRoundNo) |
void |
setCurrentTurnNo(int currentTurnNo) |
void |
setGame(Game game) |
void |
setGameState(GameState gameState) |
void |
setSetTokenTurn(Boolean isSetTokenTurn) |
void |
startGame()
sets the game state to RUNNING and saves the time that happened
|
void |
update(Observable o,
Object arg) |
void |
updateTurnInformation(Player activePlayer,
int currentRoundNo,
Position nextTilePos)
Updates information related to a turn (activePlayer, currentRoundNo, nextTilePos).
|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
public void update(Observable o, Object arg)
public Player getActivePlayer()
public void setActivePlayer(Player activePlayer)
public boolean isSetTokenTurn()
public void setSetTokenTurn(Boolean isSetTokenTurn)
public int getCurrentRoundNo()
public void setCurrentRoundNo(int currentRoundNo)
public int getCurrentTurnNo()
public void setCurrentTurnNo(int currentTurnNo)
public Game getGame()
getGame
in class AGameModel
public void setGame(Game game)
setGame
in class AGameModel
public Position getNextTilePos()
public long getTimePassedTurn()
public long getTimePassedGame()
public GameState getGameState()
public void setGameState(GameState gameState)
public FinishedReason getFinishedReason()
public void startGame()
AGameModel
public void pauseGame()
AGameModel
public void continueGame()
AGameModel
public void endGame(FinishedReason finishedReason)
AGameModel
Placements
finishedReason
- the given reason why the game is finishedpublic void increaseCurrentTurnNo()
public void updateTurnInformation(Player activePlayer, int currentRoundNo, Position nextTilePos)
activePlayer
- the Player object of the player whose turn it iscurrentRoundNo
- the number of the current roundnextTilePos
- the position where the next tile has to be placedpublic void addPlacement(Placement placement)
AGameModel
Placement
object to the HashMap of Placements
that are currently
on the board of the belonging Game
placement
- the Placement
object that should be addedpublic Placement getPlacementByPosition(Position position)
position
- the position to look for a placementpublic Iterator<Placement> getPlacementsIterator()
public int getPlacementsCount()
public Map<Position,Set<Gate>> getIllegalGates()
Calculates all Gate
s adjacent to Position
s on which no Tile
can
be placed, i.e. blocked Position
s and the board's border.
The returned Map
contains all Position
s on which at least one of these
Gate
s exists as keys, and a Set
of all illegal Gate
s of that
Position
as the value.
Position
s on which there are no illegal Gate
s are not included.
Copyright © 2017 smarTen. All rights reserved.