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

Method kingAndPawnOut

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

Source from the content-addressed store, hash-verified

293 }
294
295 @Test
296 public void kingAndPawnOut() {
297 Board board = Board.getStartBoard();
298 board = board.copy();
299 board.makeMove(board.getLegalMoves()
300 .stream()
301 .filter(c -> c.piece.sameType(PieceType.PAWN))
302 .filter(c -> c.piece.position.equals(Cell.get(1, 3)))
303 .filter(c -> c.target.equals(Cell.get(2, 3)))
304 .findAny()
305 .get());
306 board = board.copy();
307 board.makeMove(board.getLegalMoves()
308 .stream()
309 .filter(c -> c.piece.sameType(PieceType.PAWN))
310 .filter(c -> c.piece.position.equals(Cell.get(6, 6)))
311 .filter(c -> c.target.equals(Cell.get(4, 6)))
312 .findAny()
313 .get());
314 board = board.copy();
315 board.makeMove(board.getLegalMoves()
316 .stream()
317 .filter(c -> c.piece.sameType(PieceType.KING))
318 .filter(c -> c.piece.position.equals(Cell.get(0, 4)))
319 .filter(c -> c.target.equals(Cell.get(1, 3)))
320 .findAny()
321 .get());
322 board = board.copy();
323 board.makeMove(board.getLegalMoves()
324 .stream()
325 .filter(c -> c.piece.sameType(PieceType.PAWN))
326 .filter(c -> c.piece.position.equals(Cell.get(4, 6)))
327 .filter(c -> c.target.equals(Cell.get(3, 6)))
328 .findAny()
329 .get());
330 System.out.println(board);
331 System.out.println(board.getLegalMoves());
332 Assert.assertEquals(22, board.getLegalMoves().size());
333 }
334}

Callers

nothing calls this directly

Calls 8

getStartBoardMethod · 0.95
copyMethod · 0.95
makeMoveMethod · 0.95
getLegalMovesMethod · 0.95
getMethod · 0.95
sameTypeMethod · 0.80
getMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected