edu.lhup.ai
Class Evaluator

java.lang.Object
  |
  +--edu.lhup.ai.Evaluator
All Implemented Interfaces:
IEvaluator

public class Evaluator
extends Object
implements IEvaluator

A default evaluator that is capable of evaluating any game. This is done by only evaluating end states. For example, this evaluator will return 0 if the current state is a tie, 1 if the current state is a victory, and -1 if the current state is a defeat. If the current state is not an end state, Integer.MIN_VALUE is returned. This evaluator is subject to the horizon problem if a cutoff is used. This is because the evaluator pays no attention to what is about to happen if the state is non-terminal.

This software is for educational purposes only.

Author:
Mark Cohen

Constructor Summary
Evaluator()
           
 
Method Summary
 int evaluate(IBoard board, IPlayer maxPlayer)
          Provides a mechanism for evaluating the current state of a game.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Evaluator

public Evaluator()
Method Detail

evaluate

public int evaluate(IBoard board,
                    IPlayer maxPlayer)
Provides a mechanism for evaluating the current state of a game.

Specified by:
evaluate in interface IEvaluator
Parameters:
board - the game that will be evaluated.
maxPlayer - the player whos perspective will be used when evaluating the specified game.
Returns:
if the current state is a tie, 0 is returned; if the current state is a victory for the "maxPlayer" 1 is returned; if the current state is a loss for the "maxPalyer" -1 is returned; finally, if the current state is not an end state, Integer.MIN_VALUE is returned.

toString

public String toString()
Overrides:
toString in class Object