Hacker News new | ask | show | jobs
by Jasper_ 1098 days ago
> - In the second bitboard, the rook on e4 should be able to move to e1,a4,e8,h4.

It's trying to find the set of legal moves. Or, rather, it's trying to find the set of illegal moves that it can exclude from the subset of possible moves. The only thing determining whether a move is legal is whether there's a piece in the way of that move, aka whether a piece is occupying a square, that's what the bitboard check is about. If E1 is occupied, the set of legal moves is the same as if it is unoccupied, so it is irrelevant to check the bitboard for E1. I agree the article could be clearer about this.

1 comments

I'm clearly misunderstanding something here. Assuming the rest of the board is empty, if e1 is occupied, the rook can't move to e1, whereas if it isn't occupied, the rook can move to e1, so there is at least one position in which we must check e1. What am I misunderstanding here?
Oh, I was assuming it was occupied by an enemy piece, and would capture it. You're right that if it was occupied by an allied piece, it's not a legal move.