org.vizzini.game.boardgame
Class TokenLineEvaluator

java.lang.Object
  extended by org.vizzini.game.AbstractEvaluator
      extended by org.vizzini.game.DefaultEvaluator
          extended by org.vizzini.game.boardgame.TokenLineEvaluator
All Implemented Interfaces:
Serializable, IEvaluator

public class TokenLineEvaluator
extends DefaultEvaluator

Provides an evaluator which uses line features, weights and token values to arrive at a grid board evaluation. The environment is evaluated for the number of tokens in all the lines: one in a row, two in a row, etc. These counts are then weighted and summed.

Since:
v0.2
Version:
v0.3
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Constructor Summary
TokenLineEvaluator()
           
 
Method Summary
protected  int addToEvaluation(int evaluation, IGridBoard gridBoard, IAgent agent, IAgent opponent, int startF, int startR, int startL, int df, int dr, int dl)
          Add to the given evaluation based on the other parameters.
protected  int addToEvaluation(int evaluation, IGridBoard gridBoard, IAgent agent, int multiplier, int startF, int startR, int startL, int df, int dr, int dl)
          Add to the given evaluation based on the other parameters.
 void configure(Properties properties, int index)
          Configure this evaluator.
protected  int evaluateTokens(IEnvironment environment, IAgent agent)
          Evaluate the tokens in the given environment from the perspective of the given agent.
 int[] getWeights()
          Return the weights.
 void setWeights(int[] weights)
          Set the weights.
 String toString()
          Return a string representation of this object.
 
Methods inherited from class org.vizzini.game.AbstractEvaluator
evaluate, multiplier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TokenLineEvaluator

public TokenLineEvaluator()
Method Detail

configure

public void configure(Properties properties,
                      int index)
Configure this evaluator.

Specified by:
configure in interface IEvaluator
Overrides:
configure in class DefaultEvaluator
Parameters:
properties - Properties.
index - Agent index.
Since:
v0.2

getWeights

public int[] getWeights()
Return the weights.

Since:
v0.2

setWeights

public void setWeights(int[] weights)
Set the weights.

Since:
v0.2

toString

public String toString()
Return a string representation of this object.

Overrides:
toString in class Object
Since:
v0.2

addToEvaluation

protected int addToEvaluation(int evaluation,
                              IGridBoard gridBoard,
                              IAgent agent,
                              IAgent opponent,
                              int startF,
                              int startR,
                              int startL,
                              int df,
                              int dr,
                              int dl)
Add to the given evaluation based on the other parameters.

Parameters:
evaluation - Previous evaluation.
gridBoard - Grid board.
agent - Agent.
opponent - Opponent of agent.
startF - Start file.
startR - Start rank.
startL - Start level.
df - Delta file.
dr - Delta rank.
dl - Delta level.
Returns:
The updated evaluation.

addToEvaluation

protected int addToEvaluation(int evaluation,
                              IGridBoard gridBoard,
                              IAgent agent,
                              int multiplier,
                              int startF,
                              int startR,
                              int startL,
                              int df,
                              int dr,
                              int dl)
Add to the given evaluation based on the other parameters.

Parameters:
evaluation -
gridBoard - Grid board.
agent - Agent.
multiplier - Multiplier for the weight; +1 for agent, -1 for opponent.
startF - Start file.
startR - Start rank.
startL - Start level.
df - Delta file.
dr - Delta rank.
dl - Delta level.
Returns:
The updated evaluation.

evaluateTokens

protected int evaluateTokens(IEnvironment environment,
                             IAgent agent)
Evaluate the tokens in the given environment from the perspective of the given agent.

Overrides:
evaluateTokens in class DefaultEvaluator
Parameters:
environment - The environment to evaluate.
agent - The agent of interest.
Since:
v0.2


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02