If White moves his pawn on h7 to h8 it can be promoted to any other piece (but not the king). Or we can look at each possible En Passant position on the board and have a flag to indicate whether its possible or not. Alternatively we can store whether each pawn on its 4th rank has just moved there with a double move forward. If we know the previous move we can definitely answer if En Passant is possible. This only happens on the first opportunity meaning if Black passes on the option now he can’t take it next move. En PassantĪnother peculiar and often-neglected rule in Chess is En Passant.īlack’s pawn on b4 now has the option of moving his pawn on b4 to c3 taking the White pawn on c4. Alternatively we could treat each unmoved piece as another piece type so instead of 6 piece types on each side (pawn, rook, knight, bishop, queen and king) there are 8 (adding unmoved rook and unmoved king). We could streamline this by only storing a bit for one of these six squares if the right piece happens to be in it. There are several strategies that can be used for dealing with this problem.įirstly, we could store an extra 6 bits of information (1 for each rook and king) to indicate whether that piece had moved. Obviously if they aren’t on their starting positions, they have moved otherwise it needs to be specified. Part of the requirements for this are that the king and the relevant rook can never have moved, so whether the king or either rook of each side has moved will need to be stored. That’s actually a problem as I’ll explain. The problem also says nothing about knowing the moves up to this point. Encoding simply the positions of the pieces is one thing but the problem says “all subsequent legal moves”. The first thing you need to determine is whether you’re storing the state of a game or the position of pieces on the board. So what’s missing or ambiguous? A lot as it turns out.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |