Algorithm
Development Kit 1.0

algs.model.problems.eightpuzzle
Class WeakEvaluator

java.lang.Object
  extended by algs.model.problems.eightpuzzle.WeakEvaluator
All Implemented Interfaces:
IScore

public class WeakEvaluator
extends java.lang.Object
implements IScore

Weak evaluation function, as drawn from Nilsson, p. 56.

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

Constructor Summary
WeakEvaluator()
           
 
Method Summary
 int eval(INode state)
          Eval = g(n) + W(n), where g(n) is length of the path from initial to node n, and W(n) counts number of misplaced tiles in the state description
 void score(INode state)
          Evaluate the given state and update its score using our scoring function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeakEvaluator

public WeakEvaluator()
Method Detail

score

public void score(INode state)
Description copied from interface: IScore
Evaluate the given state and update its score using our scoring function.

Specified by:
score in interface IScore
Parameters:
state - The board state whose score value is to be updated.
See Also:
IScore.score(INode)

eval

public int eval(INode state)
Eval = g(n) + W(n), where g(n) is length of the path from initial to node n, and W(n) counts number of misplaced tiles in the state description

Specified by:
eval in interface IScore
Parameters:
state - state being evaluated
See Also:
IScore.score(INode)

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.