public bool isGoalState(Object state) { board = (NQueensBoard) state; return (allQueensPlaced() && allQueenPositionsHaveZeroAttacks(board .getQueenPositions())); }
private NQueensBoard placeQueenAt(int row, int column, NQueensBoard parentBoard) { NQueensBoard newBoard = new NQueensBoard(parentBoard.getSize()); ArrayList queenPositionsOnParentBoard = parentBoard.getQueenPositions(); queenPositionsOnParentBoard.Add(new XYLocation(row, column)); newBoard.setBoard(queenPositionsOnParentBoard); return newBoard; }
private NQueensBoard placeQueenAt(int row, int column, NQueensBoard parentBoard) { NQueensBoard newBoard = new NQueensBoard(parentBoard.getSize()); ArrayList queenPositionsOnParentBoard = parentBoard.getQueenPositions(); queenPositionsOnParentBoard.Add(new XYLocation(row, column)); newBoard.setBoard(queenPositionsOnParentBoard); return(newBoard); }
public bool isGoalState(Object state) { board = (NQueensBoard)state; return(allQueensPlaced() && allQueenPositionsHaveZeroAttacks(board .getQueenPositions())); }