public int getNumberOfAttackingPairs()
{
int result = 0;
foreach (XYLocation location in getQueenPositions())
{
result += getNumberOfAttacksOn(location);
}
return result / 2;
}
public bool isGoalState(Object state) { NQueensBoard board = (NQueensBoard)state; return(board.getNumberOfQueensOnBoard() == board.getSize() && board.getNumberOfAttackingPairs() == 0); }