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

Method stopFindingPin

src/main/java/game/Board.java:332–352  ·  view source on GitHub ↗
(int row, int col, Color color,
                                  Reference<Piece> blockingPiece, Map<Piece, Piece> blockingChecks,
                                  PieceType... attackerTypes)

Source from the content-addressed store, hash-verified

330 }
331
332 public boolean stopFindingPin(int row, int col, Color color,
333 Reference<Piece> blockingPiece, Map<Piece, Piece> blockingChecks,
334 PieceType... attackerTypes) {
335 if (!isEmpty(row, col)) {
336 final Piece piece = getPiece(row, col);
337 if (blockingPiece.object == null) {
338 if (piece.color == color) {
339 blockingPiece.object = piece;
340 return false;
341 } else {
342 return true;
343 }
344 } else {
345 if (piece.color != color && Arrays.stream(attackerTypes).anyMatch(piece::sameType)) {
346 blockingChecks.put(blockingPiece.object, piece);
347 }
348 return true;
349 }
350 }
351 return false;
352 }
353
354 private Set<Piece> attackingKing(Piece king) {
355 final HashSet<Piece> attackers = new HashSet<>();

Callers 1

pinnedToKingMethod · 0.95

Calls 2

isEmptyMethod · 0.95
getPieceMethod · 0.95

Tested by

no test coverage detected