Algorithm
Development Kit 1.0

algs.model.gametree
Class MinimaxEvaluation

java.lang.Object
  extended by algs.model.gametree.MinimaxEvaluation
All Implemented Interfaces:
IEvaluation

public class MinimaxEvaluation
extends java.lang.Object
implements IEvaluation

Perform a MiniMax evaluation over a game state to the fixed ply depth.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Field Summary
 int numStates
           
 
Constructor Summary
MinimaxEvaluation(int ply)
          Create an evaluator with the given state.
 
Method Summary
 IGameMove bestMove(IGameState s, IPlayer player, IPlayer opponent)
          Initiates the MiniMax computations by using its ply to determine the maximum number of moves in advance to look.
 java.lang.String toString()
          Expose game state as string (useful for debugging purposes).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numStates

public int numStates
Constructor Detail

MinimaxEvaluation

public MinimaxEvaluation(int ply)
Create an evaluator with the given state. It is important that the same player evaluate the state regardless of MIN and MAX. The player will be known when bestMove is invoked.

Parameters:
ply - Depth to search.
Method Detail

bestMove

public IGameMove bestMove(IGameState s,
                          IPlayer player,
                          IPlayer opponent)
Initiates the MiniMax computations by using its ply to determine the maximum number of moves in advance to look.

If no moves are available to player, then null is returned.

Specified by:
bestMove in interface IEvaluation
Parameters:
s - Initial game state
player - The player making the next move
opponent - The player's opponent

toString

public java.lang.String toString()
Expose game state as string (useful for debugging purposes).

Overrides:
toString in class java.lang.Object

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.