|
||||||||||
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<E>
public abstract class Game<E extends GameState>
Field Summary | |
---|---|
protected List<AgentMeasure> |
agentMeasurement
|
protected int |
currentPlayer
|
protected List<Agent> |
players
|
Constructor Summary | |
---|---|
Game()
Default constructor |
|
Game(Game<E> other)
Copy constructor |
|
Game(Game<E> other,
E newState)
Copy constructor, copy the given Game object but use the given GameState obect. |
Method Summary | |
---|---|
void |
addMeasurement(AgentMeasure measure)
Add a new AgentMeasure to the list of measurements |
void |
assignPlayerScore(int playerID,
Fitness score)
Assign a score to a player |
void |
clearMeasurementData()
Clear all the measured data while keeping all the AgentMeasure |
void |
clearMeasurements()
Remove all AgentMeasure objects in the list |
abstract void |
display()
Print the game to the console, is useful during testing. |
abstract boolean |
gameOver()
check if the game should terminate |
List<AgentMeasure> |
getAgentMeasurements()
|
abstract Game<E> |
getClone()
Create a cloned copy of the current object and return it. |
abstract Game<E> |
getClone(E 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. |
int |
getCurrentIteration()
|
int |
getCurrentPlayer()
|
E |
getCurrentState()
returns the current state of the game, this isnt always the same as the decision state |
E |
getDecisionState()
Returns the state of the game that the agent needs to make a decision. |
DomainRegistry |
getDomainForPlayer(int playerID)
This method is used to get the specific domain for an agents solution vector |
abstract AbstractGameResult |
getGameResult()
Get the result of the game (Win/Lose/Draw) |
int |
getNextPlayerID(int playerID)
This method returns the playerID who would play directly after the playerID that is given to the method. |
Agent |
getPlayer(int playerID)
|
int |
getPlayerCount()
get the number of players |
int[] |
getPlayerIDList(int startPlayerID)
return a list of all the playerID's, in the order that they would play starting with startPlayerID |
Fitness |
getPlayerScore(int playerID)
return the fitness of the agent |
GameScoringStrategy |
getScoringStrategy()
|
void |
initializeAgent(int playerID,
Type agentData)
This method initializes an agent with entity data. |
abstract void |
initializeGame()
perform any game specific initialization |
void |
playGame()
|
void |
playGame(boolean display)
initialize and play the game until the end conditions are met while recording any playing information. |
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 |
setCurrentGameState(E state)
Set the current state of the game |
void |
setCurrentPlayer(int currentPlayer)
|
void |
setEntityScore(int playerID,
EntityScore score)
Store the result and fitness for a specific player in the entityscore object |
void |
setScoringStrategy(GameScoringStrategy scoringStrategy)
Set the GameScoringStrategy for this game. |
void |
setSeedingStrategy(GameSeedingStrategy seedStrategy)
Set the seeding strategy of the game, this will determine how many and when unique games are played. |
void |
setStartPlayer(int startPlayer)
Re-arrange the players in the player vector to put a new agent first |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<Agent> players
protected int currentPlayer
protected List<AgentMeasure> agentMeasurement
Constructor Detail |
---|
public Game()
public Game(Game<E> other)
other
- the other game objectpublic Game(Game<E> other, E newState)
other
- the other game objectnewState
- the new state to use as this Game's GameStateMethod Detail |
---|
public E getDecisionState()
public E getCurrentState()
public void setCurrentGameState(E state)
state
- the new game statepublic void setAgent(Agent player)
player
- the Agent to addpublic void setAgent(Agent player, int playerID)
player
- the new AgentplayerID
- the playerID for the agentpublic DomainRegistry getDomainForPlayer(int playerID)
playerID
- the id of the player
public void assignPlayerScore(int playerID, Fitness score)
playerID
- the id of the playerscore
- the fitnesspublic Fitness getPlayerScore(int playerID)
playerID
- the id of the player
public int getPlayerCount()
public void initializeAgent(int playerID, Type agentData)
playerID
- the id of the playeragentData
- the entity data that the agent uses to make decisionspublic void setStartPlayer(int startPlayer)
startPlayer
- the id of the lpayer to go firstpublic Agent getPlayer(int playerID)
public int getNextPlayerID(int playerID)
playerID
- the playerID that preceeds the playerID to be returned
public int[] getPlayerIDList(int startPlayerID)
startPlayerID
- the ID of the starting player
public void clearMeasurements()
public void clearMeasurementData()
public List<AgentMeasure> getAgentMeasurements()
public void addMeasurement(AgentMeasure measure)
measure
- the new measurementpublic void playGame(boolean display)
public void playGame()
public void setEntityScore(int playerID, EntityScore score)
playerID
- the id of the agentscore
- the entityscore object that is manipulatedpublic abstract void initializeGame()
public abstract boolean gameOver()
public abstract AbstractGameResult getGameResult()
public abstract Game<E> getClone()
getClone
in interface Cloneable
Object.clone()
public abstract Game<E> getClone(E newState)
newState
- the new sate to use
public abstract void display()
public void setScoringStrategy(GameScoringStrategy scoringStrategy)
scoringStrategy
- the scoring strategypublic int getCurrentIteration()
public int getCurrentPlayer()
public void setCurrentPlayer(int currentPlayer)
public GameScoringStrategy getScoringStrategy()
public void setSeedingStrategy(GameSeedingStrategy seedStrategy)
seedStrategy
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |