4 ms·
There's a logic error from assuming that because the rook is in its original position that the rook has not moved. Also I'm not sure if en passant is available
by efitz 9mo ago
There's a logic error from assuming that because the rook is in its original position that the rook has not moved. Also I'm not sure if en passant is available if the pawn has moved from its home file, even if it subsequently moved back - so you can't assume either of these just by looking at the piece's position.
I think that you need one extra bit, that can contextually encode "rook has moved" or "en passant available".
- vntok 9mo agoIf the rook has the king's position, it's never moved. As soon as it moves, it can have any position except the king's.
- tromp 9mo agoTo make this work, the rook can only have the king's position, if neither the king nor that rook have moved.
- efitz 9mo agoHow do you differentiate between "never moved" and "moved but moved back"?
- vntok 9mo agoIf the rook has not ever moved yet, it gets the king's positional value. As both pieces can't overlap, assume the king's positional value is correct and the rook is at starting position. Then, as soon as the rook is moved, it gets its actual positional value. If it moves back later, the positional value will be that of the rook's starting position (guaranteed different from the king's current positional value as the two pieces can't overlap).
- cestith 9mo agoIt would be if castle is available, not simply if the rook has never moved. Likewise, the position of a pawn can be assigned the king’s position if it has made the double move. You know it’s actually in the legal file and in which rank it sits after the move.
- bobmcnamara 9mo agoYou could decide if the en passant location is plausible from the position and color of the pawn on ranks 3 & 6, since it's only available of a pawn has moved two squares, so must be on rank 3 or 6, and it hasn't been promoted(another way it could reach those ranks)
- nvader 9mo agoAt the start of the game, qRook - king - kRook all store the location e1. If the king moves (say we're playing the Bongcloud), qR and kR get set back to their original squares, a1 and h1. Now if the King slides back, castling is off the board.