All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aima.core.environment.nqueens.AttackingPairsHeuristic Maven / Gradle / Ivy

Go to download

AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.

The newest version!
package aima.core.environment.nqueens;

import aima.core.search.framework.evalfunc.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 - 2024 Weber Informatics LLC | Privacy Policy