games.strategy.common.player.ai
Class AIAlgorithm

java.lang.Object
  extended by games.strategy.common.player.ai.AIAlgorithm

public class AIAlgorithm
extends java.lang.Object

Utility class implementing AI game algorithms. Currently, minimax and alpha-beta algorithms are implemented.

Version:
$LastChangedDate: 2008-01-04 14:33:48 -0800 (Fri, 04 Jan 2008) $
Author:
Lane Schwartz
See Also:
"Chapter 6 of Artificial Intelligence, 2nd ed. by Stuart Russell & Peter Norvig"

Constructor Summary
AIAlgorithm()
           
 
Method Summary
static
<Play> Play
alphaBetaSearch(GameState<Play> state)
          Find the optimal next play to perform from the given game state, using the alpha-beta algorithm.
static
<Play> java.util.Stack<Play>
depthFirstSearch(GameState<Play> state, int maxDepth)
           
static
<Play> Play
minimaxSearch(GameState<Play> state)
          Find the optimal next play to perform from the given game state, using the minimax algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AIAlgorithm

public AIAlgorithm()
Method Detail

depthFirstSearch

public static <Play> java.util.Stack<Play> depthFirstSearch(GameState<Play> state,
                                                            int maxDepth)

alphaBetaSearch

public static <Play> Play alphaBetaSearch(GameState<Play> state)
Find the optimal next play to perform from the given game state, using the alpha-beta algorithm.

Type Parameters:
Play - class capable of representing a game play
Parameters:
state - current game state
Returns:
the optimal next play

minimaxSearch

public static <Play> Play minimaxSearch(GameState<Play> state)
Find the optimal next play to perform from the given game state, using the minimax algorithm.

Type Parameters:
Play - class capable of representing a game play
Parameters:
state - current game state
Returns:
the optimal next play