| 165 | } |
| 166 | |
| 167 | @Test |
| 168 | public void canCastleLeft() { |
| 169 | Board board = new Board(); |
| 170 | board.canCastle[0][1] = false; |
| 171 | board.placeKing(0, 4, Color.WHITE); |
| 172 | board.placeKing(7, 4, Color.BLACK); |
| 173 | board.placeRook(0, 0, Color.WHITE); |
| 174 | System.out.println(board); |
| 175 | System.out.println(board.getPiece(0, 4).getMoveList(board)); |
| 176 | Assert.assertEquals(6, board.getPiece(0, 4).getMoveList(board).size()); |
| 177 | Assert.assertTrue(board.getPiece(0, 4).getMoveList(board).stream().noneMatch(c -> c.captureMove)); |
| 178 | board.makeMove(board.getPiece(0, 4).getMoveList(board).stream().filter(c -> Math.abs(c.piece.position.col - c.target.col) == 2).findAny().get()); |
| 179 | System.out.println(board); |
| 180 | System.out.println(board.getPiece(0, 2).getMoveList(board)); |
| 181 | Assert.assertEquals(4, board.getPiece(0, 2).getMoveList(board).size()); |
| 182 | Assert.assertEquals(11, board.getPiece(0, 3).getMoveList(board).size()); |
| 183 | } |
| 184 | |
| 185 | @Test |
| 186 | public void canCastleRight() { |