Algorithm
Development Kit 1.0

algs.model.gametree.debug
Class NegMaxEvaluation

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

public class NegMaxEvaluation
extends java.lang.Object
implements IEvaluation

Represents an Intelligent Tic Tac Toe playing agent that uses the NegMax algorithm to select a move. This implementation is quite different from the non-debug version; this was done because of the convoluted nature of the debugging code to generate the game trees. After execution, the debug information is properly invoked on the provided IDebugSearch interface.

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

Constructor Summary
NegMaxEvaluation(int ply)
          Create an evaluator with the given state.
 
Method Summary
 IGameMove bestMove(IGameState state, IPlayer player, IPlayer opponent)
          Initiates the MiniMax computations by determining the maximum number of moves in advance to look.
 void debug(IDebugSearch debug)
          Install debugger to use.
 java.lang.String toString()
          Expose board state as string (useful for debugging purposes).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NegMaxEvaluation

public NegMaxEvaluation(int ply)
Create an evaluator with the given state. It is important that the same player evaluate the board 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 state,
                          IPlayer player,
                          IPlayer opponent)
Initiates the MiniMax computations by determining the maximum number of moves in advance to look. Note that player is the INTELLIGENT player making the move; the opponent may be a human player but also may be an intelligent player.

Specified by:
bestMove in interface IEvaluation
Parameters:
state - Game state being evaluated.
player - The player making the next move.
opponent - Opponent of player who will make counter moves

toString

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

Overrides:
toString in class java.lang.Object

debug

public void debug(IDebugSearch debug)
Install debugger to use.

Parameters:
debug - debugger to use.

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.