Sliding pieces moves are now illegal if it's after the enemy

This commit is contained in:
cdricms
2024-07-01 16:14:49 +02:00
parent d3503f1441
commit cf42721235
4 changed files with 24 additions and 1 deletions

View File

@@ -22,6 +22,14 @@ final class Bishop: Piece, DiagonalMoves {
}
if last == nil {
legalPositions.append(position)
if let square = delegate?.getSquareInfo(on: position),
let piece = square.piece
{
if piece.color != color {
delegate?.notify(.piecePinned(from: self, on: piece))
last = position
}
}
}
}
}