Code: Select all
pieceList[color][piece_type][16]
Code: Select all
pieceList[piece_type_and_color][16]
I've added into the doMove() and undoMove() functions a minimum amount of code necessary to keep the array update (2 lines of code in each one). Then I changed all move generation functions to use the piece lists for iterating though the pieces in the board:
Code: Select all
Square from;
Square* list = board.pieceList[WHITE_PAWN];
while ((from=*list++) != NONE) {
attacks = getPawnCaptures(from,mask) ;
...
Code: Select all
Square from = extractLSB(board.getPieces(WHITE_PAWN));
while ( from!=NONE ) {
attacks = getPawnCaptures(from,mask) ;
Square target = extractLSB(attacks);
...
from = extractLSB(pieces);
}
I thought it would get slightly faster when using piece lists by saving some millions of bit scans. Well I guess I was wrong. Or am I doing something wrong? Any thoughts?