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

Method updateKingMoves

src/main/java/game/Board.java:432–445  ·  view source on GitHub ↗
(Move move, Piece king)

Source from the content-addressed store, hash-verified

430 }
431
432 private void updateKingMoves(Move move, Piece king) {
433 final Cell target = move.target;
434 final Cell start = move.piece.position;
435 final Cell capture = move.captureCell;
436 removeMoves(king.position);
437 //add guard moves in vicinity
438 //occupied cell allows more moves ->
439 //occupied cell allows less moves -> Opponent long piece moved into square. Remove all squares affected.
440 //free cell allows more moves -> Impossible
441 //free cell allows less moves -> Opponent long piece on other side, remove squares affected.
442 //nearby moves of pawn -> My pawns have no affect. Enemy can guard.
443 //knight moves -> My knight has no affect. Enemy can guard.
444 //king moves -> If it's my kind, remove moves. Else can guard.
445 }
446
447 private void updateForClearCell(final Cell affectedCell) {
448 longRangeUpdate(affectedCell, (piece) -> {

Callers 1

makeMoveMethod · 0.95

Calls 1

removeMovesMethod · 0.95

Tested by

no test coverage detected