// Light green: exit room targets @Test public void testTargetsRoomExits2() { targets = board.getTargets(board.calcIndex(0, 11), 1); assertTrue(targets.contains(board.getCellAt(board.calcIndex(0, 10)))); assertEquals(1, targets.size()); targets = board.getTargets(board.calcIndex(0, 11), 3); assertTrue(targets.contains(board.getCellAt(board.calcIndex(2, 10)))); assertEquals(1, targets.size()); }
// Light green: exit room targets @Test public void testTargetsRoomExits1() { targets = board.getTargets(board.calcIndex(6, 1), 1); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 1)))); assertEquals(1, targets.size()); targets = board.getTargets(board.calcIndex(6, 1), 2); assertTrue(targets.contains(board.getCellAt(board.calcIndex(8, 1)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 0)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 2)))); assertEquals(3, targets.size()); }
// Black: enter room targets @Test public void testTargetsIntoRoom1() { targets = board.getTargets(board.calcIndex(7, 3), 3); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 1)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 0)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(8, 1)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 2)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(8, 3)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 4)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 6)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(8, 5)))); assertEquals(8, targets.size()); }
// Light blue: test targets @Test public void testTargetsOneStep() { Set<BoardCell> targets = board.getTargets(board.calcIndex(4, 10), 1); assertTrue(targets.contains(board.getCellAt(board.calcIndex(3, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(5, 10)))); assertEquals(2, targets.size()); targets = board.getTargets(board.calcIndex(14, 13), 1); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 13)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 14)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 12)))); assertEquals(3, targets.size()); }
// Black: enter room targets @Test public void testTargetsIntoRoom2() { targets = board.getTargets(board.calcIndex(11, 9), 3); assertTrue(targets.contains(board.getCellAt(board.calcIndex(8, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(9, 8)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(11, 8)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(11, 7)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 8)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(10, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(12, 9)))); assertEquals(9, targets.size()); }
// Light blue: test targets @Test public void testTargetsFourSteps() { targets = board.getTargets(board.calcIndex(4, 10), 4); assertTrue(targets.contains(board.getCellAt(board.calcIndex(0, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(5, 11)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 8)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 12)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 11)))); assertEquals(7, targets.size()); targets = board.getTargets(board.calcIndex(14, 13), 4); assertTrue(targets.contains(board.getCellAt(board.calcIndex(12, 15)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 12)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 14)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 16)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 11)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 15)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 17)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 13)))); // Door assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 14)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 16)))); assertEquals(12, targets.size()); targets = board.getTargets(board.calcIndex(8, 9), 4); assertTrue(targets.contains(board.getCellAt(board.calcIndex(5, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 7)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 11)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 6)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 8)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 12)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(8, 5)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(8, 7)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(9, 8)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(10, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(11, 8)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(12, 9)))); assertEquals(14, targets.size()); targets = board.getTargets(board.calcIndex(15, 4), 4); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 4)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 6)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 5)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 7)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 0)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 2)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(16, 1)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(16, 3)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 1)))); // Door assertTrue(targets.contains(board.getCellAt(board.calcIndex(17, 2)))); // Door assertEquals(10, targets.size()); }
// Light blue: test targets @Test public void testTargetsThreeSteps() { targets = board.getTargets(board.calcIndex(4, 10), 3); assertTrue(targets.contains(board.getCellAt(board.calcIndex(1, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 11)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 10)))); assertEquals(4, targets.size()); targets = board.getTargets(board.calcIndex(14, 13), 3); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 11)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 12)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 14)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 15)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 16)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 15)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 13)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 13)))); assertEquals(9, targets.size()); targets = board.getTargets(board.calcIndex(8, 9), 3); assertTrue(targets.contains(board.getCellAt(board.calcIndex(8, 6)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 7)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 8)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(8, 8)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 11)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(9, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(11, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(10, 8)))); assertEquals(10, targets.size()); targets = board.getTargets(board.calcIndex(15, 4), 3); assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 1)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 3)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 5)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(16, 2)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(16, 4)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 4)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 6)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 5)))); assertEquals(8, targets.size()); }
// Light blue: test targets @Test public void testTargetsTwoSteps() { Set<BoardCell> targets = board.getTargets(board.calcIndex(4, 10), 2); assertTrue(targets.contains(board.getCellAt(board.calcIndex(2, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(5, 11)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 10)))); assertEquals(3, targets.size()); targets = board.getTargets(board.calcIndex(14, 13), 2); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 11)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 12)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 14)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 14)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 15)))); assertEquals(5, targets.size()); targets = board.getTargets(board.calcIndex(8, 9), 2); assertTrue(targets.contains(board.getCellAt(board.calcIndex(8, 7)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 8)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(6, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(7, 10)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(10, 9)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(9, 8)))); assertEquals(6, targets.size()); targets = board.getTargets(board.calcIndex(15, 4), 2); assertTrue(targets.contains(board.getCellAt(board.calcIndex(15, 2)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(13, 4)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(14, 5)))); assertTrue(targets.contains(board.getCellAt(board.calcIndex(16, 3)))); assertEquals(4, targets.size()); }