games.strategy.common.player.ai
Class GameState<Play>

java.lang.Object
  extended by games.strategy.common.player.ai.GameState<Play>
Type Parameters:
Play - class capable of representing a game play

public abstract class GameState<Play>
extends java.lang.Object

Abstract class representing game state, for use by AI game algorithms.

Version:
$LastChangedDate: 2007-12-14 06:58:18 -0800 (Fri, 14 Dec 2007) $
Author:
Lane Schwartz
See Also:
"Chapter 6 of Artificial Intelligence, 2nd ed. by Stuart Russell & Peter Norvig"

Constructor Summary
GameState()
           
 
Method Summary
abstract  boolean cutoffTest()
          Test to see if the current state represents a pseudu-terminal state.
abstract  boolean gameIsOver()
          Test to see if the current state represents an endgame state.
abstract  Play getMove()
          Get the play which resulted in this state.
abstract  GameState<Play> getSuccessor(Play play)
          Get the state which will result from performing the specified play.
abstract  float getUtility()
          Get the utility (or heuristic evaluation score) for this state.
abstract  java.util.Collection<GameState<Play>> successors()
          Get the collection of all states which can be reached from this state by performing a legal play.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameState

public GameState()
Method Detail

getSuccessor

public abstract GameState<Play> getSuccessor(Play play)
Get the state which will result from performing the specified play.

Parameters:
play - a legal game play
Returns:
the state which will result from performing the specified play

getMove

public abstract Play getMove()
Get the play which resulted in this state.

Returns:
the play which resulted in this state

successors

public abstract java.util.Collection<GameState<Play>> successors()
Get the collection of all states which can be reached from this state by performing a legal play.

Returns:
Collection of successor states

getUtility

public abstract float getUtility()
Get the utility (or heuristic evaluation score) for this state.

Returns:
the utility (or heuristic evaluation score) for this state

gameIsOver

public abstract boolean gameIsOver()
Test to see if the current state represents an endgame state.

Returns:
true this state represents an endgame state, false otherwise.

cutoffTest

public abstract boolean cutoffTest()
Test to see if the current state represents a pseudu-terminal state. This method is used during alpha-beta pruning.

If this method returns true, then successors() must return a non-empty Collection.

Likewise, if this method returns false, then successors() must return an empty Collection.

All endgame states are pseudo-terminal states. Additionally, any state which the AI search algorithm should not search beyond are pseudo-terminal states.

Returns:
true this state represents a pseudo-terminal state, false otherwise.