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

Method captureOnEdge

src/test/java/PawnTest.java:119–158  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

117 }
118
119 @Test
120 public void captureOnEdge() {
121 Board board = Board.getStartBoard();
122 board = board.copy();
123 board.makeMove(board.getLegalMoves()
124 .stream()
125 .filter(c -> c.piece.sameType(PieceType.PAWN))
126 .filter(c -> c.piece.position.equals(Cell.get(1, 0)))
127 .filter(c -> c.target.equals(Cell.get(2, 0)))
128 .findAny()
129 .get());
130 board = board.copy();
131 board.makeMove(board.getLegalMoves()
132 .stream()
133 .filter(c -> c.piece.sameType(PieceType.PAWN))
134 .filter(c -> c.piece.position.equals(Cell.get(6, 0)))
135 .filter(c -> c.target.equals(Cell.get(5, 0)))
136 .findAny()
137 .get());
138 board = board.copy();
139 board.makeMove(board.getLegalMoves()
140 .stream()
141 .filter(c -> c.piece.sameType(PieceType.PAWN))
142 .filter(c -> c.piece.position.equals(Cell.get(1, 1)))
143 .filter(c -> c.target.equals(Cell.get(3, 1)))
144 .findAny()
145 .get());
146 board = board.copy();
147 board.makeMove(board.getLegalMoves()
148 .stream()
149 .filter(c -> c.piece.sameType(PieceType.PAWN))
150 .filter(c -> c.piece.position.equals(Cell.get(5, 0)))
151 .filter(c -> c.target.equals(Cell.get(4, 0)))
152 .findAny()
153 .get());
154 System.out.println(board);
155 System.out.println(board.getLegalMoves().stream().map(Move::toString).collect(Collectors.joining("\n")));
156 System.out.println(board.fenRepresentation());
157 Assert.assertEquals(20, board.getLegalMoves().size());
158 }
159}
160
161/*

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected