Author: Uri Blass
Date: 07:57:24 09/17/04
Go up one level in this thread
On September 17, 2004 at 03:59:30, Gerd Isenberg wrote: >On September 16, 2004 at 21:20:50, Uri Blass wrote: > >>What is faster doing a loop on the 1's of a bitboard or doing a loop on array of >>integers > >Guessing you want square indicies, clearly traversing an array of integer is >faster, because you don't need the rather expensive bitscans or log2(singlebit). I thought that array 64*8 is relatively big array and looking at the right place in the array may be expensive(this is one of the reason that I considered to do it for knights). I did not think to get rid of the knight list that is a cheap way to find knight squares and I also thought that maybe I can have cheaper way to find the squares that the knight can go. Another reason that I considered to have bitboards for knight attacks it for knights is that I think about marking checks in my move generator like smirf(I have ideas how to use the information but I am not sure if they can compensate for the cost). I already have function to calculate if moves are check moves in the qsearch and the first thing that I do before generating moves is marking checking squares I have the following loop for (j=0;j<knightnumber[enemyking];j++) squareattackking[knightmove[enemyking][j]]=KNIGHT; I thought to save this calculation by having bitboard of knight attacks but the problem is that in that case using the bitboard seem to be more expensive. I think now that a better solution is simply to avoid this calculation in most cases and simply loop on the knight list that may be empty and only if I find some knight at distance 2 from the king to do that calculation. The question now is how to find if knight is at distance 2 from the king square. It is possible to have 64*64 array for knight distances but I doubt if it is the best solution because I am afraid that 64*64 array is expensive. In most cases it is possible to detect easily that 2 squares are not at knight distance 2 only by the file distance and the rank distance and I suspect that using small array first to detect it and using the big array only in rare cases(a1 b2) may be cheaper. > >> >>I simply consider to change my knight move generator to bitboards >> > >Probably a bad idea to do it only for knights. >Do it for all pieces or not. I already have bitboards for pawn structure that include bitboard for pawns and I do not plan to change it but I have no bitboards for other pieces and I also do not loop on the bitboard of pawns to look at the piece list. I guess that it is a bad idea to get rid of the piece list for pawns because if finding the next 1 is slow finding the next 1 for many pawns is even slower and saving the time of incremental update of the pawn list is not worth it. Uri
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.