|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.cilib.games.game.Game<TetrisGameState> net.sourceforge.cilib.games.game.tetris.Tetris
public class Tetris
This is an implimentation of the game of Tetris.
Field Summary |
---|
Fields inherited from class net.sourceforge.cilib.games.game.Game |
---|
agentMeasurement, currentPlayer, players |
Constructor Summary | |
---|---|
Tetris()
|
|
Tetris(Tetris other)
|
|
Tetris(Tetris other,
TetrisGameState newState)
|
Method Summary | |
---|---|
void |
display()
Print the game to the console, is useful during testing. |
boolean |
gameOver()
check if the game should terminate |
List<GameState> |
generateStates(int currentPlater)
This method generates every possible from the current state for a specific player |
Tetris |
getClone()
Create a cloned copy of the current object and return it. |
Tetris |
getClone(TetrisGameState newState)
Get a clone with the given GameState This method should typically be used by the StateTraversalStrategy and Agent with regards to decision making when playing the game. |
AbstractGameResult |
getGameResult()
Get the result of the game (Win/Lose/Draw) |
int |
getHeight()
|
int |
getMaxLines()
|
int |
getWidth()
|
void |
initializeGame()
perform any game specific initialization |
void |
recordRoundStartState()
Record the state of the game at the start of the round |
void |
setAgent(Agent player)
Add a new agent |
void |
setAgent(Agent player,
int playerID)
Add an agent with a specified playerID, if it already exists, replace it |
void |
setHeight(int height)
|
void |
setMaxLines(int maxLines)
|
void |
setWidth(int width)
|
void |
Update()
This method should update any game elements outside the control of the players |
Methods inherited from class net.sourceforge.cilib.games.game.Game |
---|
addMeasurement, assignPlayerScore, clearMeasurementData, clearMeasurements, getAgentMeasurements, getCurrentIteration, getCurrentPlayer, getCurrentState, getDecisionState, getDomainForPlayer, getNextPlayerID, getPlayer, getPlayerCount, getPlayerIDList, getPlayerScore, getScoringStrategy, initializeAgent, playGame, playGame, setCurrentGameState, setCurrentPlayer, setEntityScore, setScoringStrategy, setSeedingStrategy, setStartPlayer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Tetris()
public Tetris(Tetris other)
public Tetris(Tetris other, TetrisGameState newState)
Method Detail |
---|
public void setAgent(Agent player)
setAgent
in class Game<TetrisGameState>
player
- the Agent to addpublic void setAgent(Agent player, int playerID)
setAgent
in class Game<TetrisGameState>
player
- the new AgentplayerID
- the playerID for the agentpublic void display()
display
in class Game<TetrisGameState>
public boolean gameOver()
gameOver
in class Game<TetrisGameState>
public Tetris getClone()
getClone
in interface Cloneable
getClone
in class Game<TetrisGameState>
Object.clone()
public Tetris getClone(TetrisGameState newState)
getClone
in class Game<TetrisGameState>
newState
- the new sate to use
public AbstractGameResult getGameResult()
getGameResult
in class Game<TetrisGameState>
public void initializeGame()
initializeGame
in class Game<TetrisGameState>
public void Update()
Update
in interface UpdateGame
public List<GameState> generateStates(int currentPlater)
generateStates
in interface StateGame
currentPlater
- the player whos turn it is
public int getWidth()
public int getHeight()
public void setWidth(int width)
public void setHeight(int height)
public void recordRoundStartState()
RealTimeGame
recordRoundStartState
in interface RealTimeGame
public void setMaxLines(int maxLines)
public int getMaxLines()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |