I have now tried to re-write my engine from using a 10x12 board representation to a bitboard one. Had to start from scratch due the massive amount of work to tweak the existing code. The progress so far:
* Created pre-computed tables for file, rank, masks, king moves, knight moves, pawn moves, and the Kindergarten method for sliding pieces as described here: https://www.chessprogramming.org/Effici ... ce_Attacks.
* Created move generation functions for all pieces which I hope is okay. They don't handle castling or enpassant yet though.
* Created a chessboard class with a 2x6 array bitboard for the pieces, 1x2 array bitboard for each colors pieces, 1x1 array bitboard for all pieces and a 1x1 array bitboard for color to move (a 0 or 1).
* Ability to generate a move object with (from_square, to_square, promotion), or add more attributes as well if needed.
Now I am having a hard time figuring out how to practically use this representation to create a game. Speed is important, that is the only reason I changed to bitboards at this stage. Here are some things I can't figure out at the moment:
1. How do I represent the actual board? In my old engine I used a dict where each square had a piece on it like this: {0: 'wR', 1: 'wN'..... 63: 'bR'}. Then I could easily loop through the board dict and get the possible moves for each piece and combine to a possible move list. Now how do I loop through the 16 bitboards to get what piece is located where in the most efficient way?
2. Right now the move generator is pseudo legal since I couldn't figure out how to do a pinned piece check with this representation. I will then have to check whether each move result in check and if so don't use it. Is this a common way to go or will this be significantly slower than trying to figure out pinned pieces in the move gen?
3. How would you handle e.p. and castling? Do you have a flag for when these are possible and then add them in the pseudo move generator? Or are these special moves handled somewhere else?
4. Is my move object concept the way to go? I have read about having it as a bit string instead with all info encoded (from, to, move_type etc). Is it very complicated to obtain the information from such string?
Sorry if this is obvious to some of you. To me it is all still very confusing but I hope to fully understand it soon
