| 183 | } |
| 184 | |
| 185 | @Test |
| 186 | public void canCastleRight() { |
| 187 | Board board = new Board(); |
| 188 | board.canCastle[0][0] = false; |
| 189 | board.placeKing(0, 4, Color.WHITE); |
| 190 | board.placeKing(7, 4, Color.BLACK); |
| 191 | board.placeRook(0, 7, Color.WHITE); |
| 192 | System.out.println(board); |
| 193 | System.out.println(board.getPiece(0, 4).getMoveList(board)); |
| 194 | Assert.assertEquals(6, board.getPiece(0, 4).getMoveList(board).size()); |
| 195 | Assert.assertTrue(board.getPiece(0, 4).getMoveList(board).stream().noneMatch(c -> c.captureMove)); |
| 196 | board.makeMove(board.getPiece(0, 4).getMoveList(board).stream().filter(c -> Math.abs(c.piece.position.col - c.target.col) == 2).findAny().get()); |
| 197 | System.out.println(board); |
| 198 | System.out.println(board.getPiece(0, 6).getMoveList(board)); |
| 199 | Assert.assertEquals(4, board.getPiece(0, 6).getMoveList(board).size()); |
| 200 | Assert.assertEquals(12, board.getPiece(0, 5).getMoveList(board).size()); |
| 201 | } |
| 202 | |
| 203 | @Test |
| 204 | public void canCastleBothSides() { |