
aima.core.environment.nqueens.AttackingPairsHeuristic Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aima-core Show documentation
Show all versions of aima-core Show documentation
AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.
package aima.core.environment.nqueens;
import aima.core.search.framework.HeuristicFunction;
/**
* Estimates the distance to goal by the number of attacking pairs of queens on
* the board.
*
* @author R. Lunde
*/
public class AttackingPairsHeuristic implements HeuristicFunction {
public double h(Object state) {
NQueensBoard board = (NQueensBoard) state;
return board.getNumberOfAttackingPairs();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy