org.eclipse.palamedes.gdl.core.model
Interface IGame

All Known Implementing Classes:
Game, GameJocular, GameJP, GameProlog

public interface IGame

The IGame interface follows the facade design pattern. It hides the game information storage, the game analysis, the reasoning machinery and the game state space representation.


Method Summary
 java.util.List<IMove[]> getCombinedMoves(IGameNode currentNode)
          Returns a list of all moves combined.
 int[] getGoalValues(IGameNode currentNode)
          Returns an array of the goal values of all players.
 GDLKnowledgeBase getKnowledgeBase()
          Returns the knowledge base that is used for this game.
 IMove[][] getLegalMoves(IGameNode currentNode)
          Returns an array of the legal moves of each player.
 int getMaxSteps()
          Returns the maximum number of steps if this information is known from the rules; otherwise -1;
 IGameNode getNextNode(IGameNode currentNode, IMove[] moves)
          Returns the child node of the parent that is connected through the specified moves.
 int getPerftValue(int n, IGameNode startNode)
          Returns the perft(n) value starting from the given startNode.
 IMove[] getRandomMove(IGameNode currentNode)
          Returns a random combined move.
 IReasoner getReasoner()
          Returns the reasoner that is used for this game.
 int getRoleCount()
          Returns the number of roles respective the number of players.
 int getRoleIndex(java.lang.String role)
          Returns the index of the given role in the role name array.
 java.lang.String[] getRoleNames()
          Returns the string representation of the role names as string array.
 java.lang.String getSourceGDL()
          Returns the original GDL description for this game.
 IGameState getState(IGameNode currentNode)
          Returns the game state associated with currentNode.
 IStatistic getStatistic()
           
 IGameTree getTree()
          Returns the game tree representation if it exists; otherwise null.
 void init(java.lang.String gdl)
          Initialises a game object.
 boolean isTerminal(IGameNode currentNode)
          Returns true if the state of the node is a terminal state
 void regenerateNode(IGameNode node)
          This method regenerates the game states if the game node lost its state information for one reason or another.
 

Method Detail

getSourceGDL

java.lang.String getSourceGDL()
Returns the original GDL description for this game.


getRoleNames

java.lang.String[] getRoleNames()
Returns the string representation of the role names as string array.


getRoleCount

int getRoleCount()
Returns the number of roles respective the number of players.


getRoleIndex

int getRoleIndex(java.lang.String role)
Returns the index of the given role in the role name array.


getTree

IGameTree getTree()
Returns the game tree representation if it exists; otherwise null.


getReasoner

IReasoner getReasoner()
Returns the reasoner that is used for this game.


getKnowledgeBase

GDLKnowledgeBase getKnowledgeBase()
Returns the knowledge base that is used for this game.


getCombinedMoves

java.util.List<IMove[]> getCombinedMoves(IGameNode currentNode)
                                         throws java.lang.InterruptedException
Returns a list of all moves combined.

Throws:
java.lang.InterruptedException

getLegalMoves

IMove[][] getLegalMoves(IGameNode currentNode)
                        throws java.lang.InterruptedException
Returns an array of the legal moves of each player.
e.g.: getLegalMoves(currentNode)[playerNumber] is an array of the legal moves of the specified player in the current state

Throws:
java.lang.InterruptedException

getRandomMove

IMove[] getRandomMove(IGameNode currentNode)
                      throws java.lang.InterruptedException
Returns a random combined move.

Throws:
java.lang.InterruptedException

getNextNode

IGameNode getNextNode(IGameNode currentNode,
                      IMove[] moves)
                      throws java.lang.InterruptedException
Returns the child node of the parent that is connected through the specified moves.

Throws:
java.lang.InterruptedException

isTerminal

boolean isTerminal(IGameNode currentNode)
                   throws java.lang.InterruptedException
Returns true if the state of the node is a terminal state

Parameters:
currentNode -
Throws:
java.lang.InterruptedException

getGoalValues

int[] getGoalValues(IGameNode currentNode)
                    throws java.lang.InterruptedException
Returns an array of the goal values of all players. A value of -1 is returned if there is no goal value for a player in this state. This may happen if the state is not terminal.

Throws:
java.lang.InterruptedException

getState

IGameState getState(IGameNode currentNode)
                    throws java.lang.InterruptedException
Returns the game state associated with currentNode. Regenerates the node if necessary.

Throws:
java.lang.InterruptedException
See Also:
regenerateNode(IGameNode node)

regenerateNode

void regenerateNode(IGameNode node)
                    throws java.lang.InterruptedException
This method regenerates the game states if the game node lost its state information for one reason or another.

Throws:
java.lang.InterruptedException

getMaxSteps

int getMaxSteps()
Returns the maximum number of steps if this information is known from the rules; otherwise -1;


getStatistic

IStatistic getStatistic()

getPerftValue

int getPerftValue(int n,
                  IGameNode startNode)
                  throws java.lang.InterruptedException
Returns the perft(n) value starting from the given startNode. The perft value is defined as the number of game nodes reachable in exactly n steps.

Throws:
java.lang.InterruptedException

init

void init(java.lang.String gdl)
Initialises a game object. This method gets called by the game factory while creating the game.

Parameters:
gdl -