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

Method kingAndKnightOut

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

Source from the content-addressed store, hash-verified

253 }
254
255 @Test
256 public void kingAndKnightOut() {
257 Board board = Board.getStartBoard();
258 board = board.copy();
259 board.makeMove(board.getLegalMoves()
260 .stream()
261 .filter(c -> c.piece.sameType(PieceType.PAWN))
262 .filter(c -> c.piece.position.equals(Cell.get(1, 3)))
263 .filter(c -> c.target.equals(Cell.get(2, 3)))
264 .findAny()
265 .get());
266 board = board.copy();
267 board.makeMove(board.getLegalMoves()
268 .stream()
269 .filter(c -> c.piece.sameType(PieceType.PAWN))
270 .filter(c -> c.piece.position.equals(Cell.get(6, 4)))
271 .filter(c -> c.target.equals(Cell.get(5, 4)))
272 .findAny()
273 .get());
274 board = board.copy();
275 board.makeMove(board.getLegalMoves()
276 .stream()
277 .filter(c -> c.piece.sameType(PieceType.KING))
278 .filter(c -> c.piece.position.equals(Cell.get(0, 4)))
279 .filter(c -> c.target.equals(Cell.get(1, 3)))
280 .findAny()
281 .get());
282 board = board.copy();
283 board.makeMove(board.getLegalMoves()
284 .stream()
285 .filter(c -> c.piece.sameType(PieceType.KNIGHT))
286 .filter(c -> c.piece.position.equals(Cell.get(7, 6)))
287 .filter(c -> c.target.equals(Cell.get(5, 5)))
288 .findAny()
289 .get());
290 System.out.println(board);
291 System.out.println(board.getLegalMoves());
292 Assert.assertEquals(23, board.getLegalMoves().size());
293 }
294
295 @Test
296 public void kingAndPawnOut() {

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