The castling rights don't seem to be updated when a rook is captured. Here's a quick test I put together:
func testCastlingRightsAfterRookCapture() {
let startFen = "rnbqkbnr/pppppp1p/8/8/1P4p1/8/PBPPPPPP/RN1QKBNR w KQkq - 0 1"
let startPosition = Game.Position(fen: startFen)!
let game = try! Game(position: startPosition)
let move = Move(start: .b2, end: .h8)
try! game.execute(move: move)
XCTAssertFalse(game.castlingRights.contains(.blackKingside))
}
It looks like _execute(uncheckedMove:promotion:) is only updating castling rights when moving rooks or kings right now.
Interestingly, I was able to generate a fen that included invalid castling rights but I couldn't initialize a Position using that same fen (a PositionError.missingRook was thrown). It might be good to include position validation during fen generation too.
Thanks for the fantastic library. Very impressive work!
The castling rights don't seem to be updated when a rook is captured. Here's a quick test I put together:
It looks like
_execute(uncheckedMove:promotion:)
is only updating castling rights when moving rooks or kings right now.Interestingly, I was able to generate a
fen
that included invalid castling rights but I couldn't initialize aPosition
using that samefen
(aPositionError.missingRook
was thrown). It might be good to include position validation duringfen
generation too.Thanks for the fantastic library. Very impressive work!