add in reachableCaptureCoordinate :
if (this::class == Pawn::class){
if (position.enPassantStatus.enPassantCoordinate?.toNum() == it.position){
captureMoveSquares.add(it)
}
}
and to avoid bug in Piece.canKingBeCaptured
if (position.board.isOccupied(it)){ // to avoid crash null pointer if enPassant = getSquare(it).pieces! is empty
add in reachableCaptureCoordinate : if (this::class == Pawn::class){ if (position.enPassantStatus.enPassantCoordinate?.toNum() == it.position){ captureMoveSquares.add(it) } }
and to avoid bug in Piece.canKingBeCaptured if (position.board.isOccupied(it)){ // to avoid crash null pointer if enPassant = getSquare(it).pieces! is empty