MCPcopy Index your code
hub / github.com/coding-parrot/chess-engine / canCastleRight

Method canCastleRight

src/test/java/KingTest.java:185–201  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 6

placeKingMethod · 0.95
placeRookMethod · 0.95
getPieceMethod · 0.95
makeMoveMethod · 0.95
getMoveListMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected