Ejemplo n.º 1
0
	public void testSimpleDiagonalAttack() {
		XYLocation loc = new XYLocation(3, 3);
		board.addQueenAt(loc);
		Assert.assertEquals(0, board.getNumberOfAttacksOn(loc));
		Assert.assertEquals(1, board.getNumberOfAttacksOn(loc.down().right()));
		Assert.assertEquals(1, board.getNumberOfAttacksOn(loc.down().left()));
		Assert.assertEquals(1, board.getNumberOfAttacksOn(loc.up().left()));
		Assert.assertEquals(1, board.getNumberOfAttacksOn(loc.up().right()));
		Assert
				.assertEquals(1, board
						.getNumberOfAttacksOn(new XYLocation(7, 7)));
		Assert
				.assertEquals(1, board
						.getNumberOfAttacksOn(new XYLocation(0, 0)));
		Assert
				.assertEquals(1, board
						.getNumberOfAttacksOn(new XYLocation(6, 0)));
		Assert
				.assertEquals(1, board
						.getNumberOfAttacksOn(new XYLocation(0, 6)));
	}
Ejemplo n.º 2
0
	public void testSimpleVerticalAttack() {
		XYLocation loc = new XYLocation(0, 0);
		board.addQueenAt(loc);
		Assert.assertEquals(0, board.getNumberOfAttacksOn(loc));
		Assert.assertEquals(1, board.getNumberOfAttacksOn(loc.down()));
		Assert
				.assertEquals(1, board
						.getNumberOfAttacksOn(new XYLocation(0, 7)));
	}