예제 #1
0
		public bool isGoalState(Object state) 
		{

			board = (NQueensBoard) state;
			return (allQueensPlaced() && allQueenPositionsHaveZeroAttacks(board
				.getQueenPositions()));
		}
예제 #2
0
		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;
		}
예제 #3
0
        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);
        }
예제 #4
0
 public bool isGoalState(Object state)
 {
     board = (NQueensBoard)state;
     return(allQueensPlaced() && allQueenPositionsHaveZeroAttacks(board
                                                                  .getQueenPositions()));
 }