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

Method captureAndReturnCheck

src/test/java/BoardTest.java:34–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32 }
33
34 @Test
35 public void captureAndReturnCheck() {
36 Board board = new Board();
37 board.placeKing(2, 5, Color.WHITE);
38 board.placeRook(2, 2, Color.BLACK);
39 board.placeKing(4, 4, Color.BLACK);
40 board.placeBishop(1, 3, Color.WHITE);
41 board.inCheck = true;
42 System.out.println(board);
43 System.out.println(board.getLegalMoves());
44 Assert.assertEquals(6, board.getLegalMoves().size());
45 Assert.assertFalse(board.isDraw());
46 Assert.assertEquals(-2, board.evaluation(board.getLegalMoves().size()), 0.3);
47 board.makeMove(board.getLegalMoves().stream().filter(c -> c.captureMove).findAny().get());
48 System.out.println(board);
49 System.out.println(board.getLegalMoves());
50 Assert.assertTrue(board.inCheck);
51 Assert.assertEquals(Color.BLACK, board.playerToMove);
52 Assert.assertTrue(board.isDraw());
53 Assert.assertEquals(4, board.getLegalMoves().size());
54 }
55
56 @Test
57 public void checkMate() {

Callers

nothing calls this directly

Calls 8

placeKingMethod · 0.95
placeRookMethod · 0.95
placeBishopMethod · 0.95
getLegalMovesMethod · 0.95
isDrawMethod · 0.95
evaluationMethod · 0.95
makeMoveMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected