Package aima.core.util.datastructure

Examples of aima.core.util.datastructure.XYLocation


  }

  @Test
  public void testAttack3() {

    board.addQueenAt(new XYLocation(0, 0));
    Assert.assertEquals(true,
        board.isSquareUnderAttack(new XYLocation(0, 1)));
  }
View Full Code Here


  }

  @Test
  public void testAttack4() {

    board.addQueenAt(new XYLocation(0, 2));
    Assert.assertTrue(board.isSquareUnderAttack(new XYLocation(1, 1)));
  }
View Full Code Here

  }

  @Test
  public void testMidBoardDiagonalAttack() {

    board.addQueenAt(new XYLocation(3, 3));
    // forwardDiagonal from the queen
    Assert.assertTrue(board.isSquareUnderAttack(new XYLocation(4, 2)));
    Assert.assertTrue(board.isSquareUnderAttack(new XYLocation(4, 4)));
    // backwardDiagonal from the queen
    Assert.assertTrue(board.isSquareUnderAttack(new XYLocation(2, 2)));
    Assert.assertTrue(board.isSquareUnderAttack(new XYLocation(2, 4)));
  }
View Full Code Here

  }

  @Test
  public void testCornerDiagonalAttack() {

    board.addQueenAt(new XYLocation(0, 0));
    // forwardDiagonal from the queen
    Assert.assertTrue(board.isSquareUnderAttack(new XYLocation(1, 1)));
    board.clear();

    board.addQueenAt(new XYLocation(7, 7));
    // backwardDiagonal from the queen
    Assert.assertTrue(board.isSquareUnderAttack(new XYLocation(6, 6)));

    // assertTrue(board.isSquareUnderAttack(new XYLocation(2, 2)));
    // assertTrue(board.isSquareUnderAttack(new XYLocation(2, 4)));
  }
View Full Code Here

  }

  @Test
  public void testAttack6() {

    board.addQueenAt(new XYLocation(1, 6));
    Assert.assertTrue(board.isSquareUnderAttack(new XYLocation(0, 7)));
  }
View Full Code Here

  }

  @Test
  public void testRemoveQueen() {

    board.addQueenAt(new XYLocation(0, 0));
    Assert.assertEquals(1, board.getNumberOfQueensOnBoard());
    board.removeQueenFrom(new XYLocation(0, 0));
    Assert.assertEquals(0, board.getNumberOfQueensOnBoard());
  }
View Full Code Here

  }

  @Test
  public void testMoveQueen() {

    XYLocation from = new XYLocation(0, 0);
    XYLocation to = new XYLocation(1, 1);

    board.addQueenAt(from);
    Assert.assertEquals(1, board.getNumberOfQueensOnBoard());
    Assert.assertTrue(board.queenExistsAt(from));
    Assert.assertFalse(board.queenExistsAt(to));
View Full Code Here

  }

  @Test
  public void testMoveNonExistentQueen() {

    XYLocation from = new XYLocation(0, 0);
    XYLocation to = new XYLocation(1, 1);
    board.moveQueen(from, to);

    Assert.assertEquals(0, board.getNumberOfQueensOnBoard());
  }
View Full Code Here

    Assert.assertEquals(0, board.getNumberOfQueensOnBoard());
  }

  @Test
  public void testRemoveNonExistentQueen() {
    board.removeQueenFrom(new XYLocation(0, 0));
    Assert.assertEquals(0, board.getNumberOfQueensOnBoard());
  }
View Full Code Here

  }

  @Test
  public void testEquality() {

    board.addQueenAt(new XYLocation(0, 0));
    NQueensBoard board2 = new NQueensBoard(8);
    board2.addQueenAt(new XYLocation(0, 0));
    Assert.assertEquals(board, board2);
    NQueensBoard board3 = new NQueensBoard(8);
    board3.addQueenAt(new XYLocation(0, 1));
    Assert.assertFalse(board.equals(board3));
  }
View Full Code Here

TOP

Related Classes of aima.core.util.datastructure.XYLocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.