design choices
Moderator: Ras
-
- Posts: 28395
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: design choices
You generate the boards in every node? That will be very slow. The whole idea of using a set of bitboards to represent the game state is that you can update those incrementally, by only changing a 2 (non-capture) or 4 (capture) of their elements. And that removing a bit and adding another bit can be done in the same XOR operation, which could be applied both to the board for the piece type of the mover as well as to the occupancy board for that color.
-
- Posts: 313
- Joined: Tue Aug 03, 2021 2:41 pm
- Full name: Bill Beame
Re: design choices
'...The whole idea of using a set of bitboards to represent the game state is that you can update those incrementally, by only changing a 2 (non-capture) or 4 (capture) of their elements. .."hgm wrote: ↑Fri Oct 21, 2022 9:57 am You generate the boards in every node? That will be very slow. The whole idea of using a set of bitboards to represent the game state is that you can update those incrementally, by only changing a 2 (non-capture) or 4 (capture) of their elements. And that removing a bit and adding another bit can be done in the same XOR operation, which could be applied both to the board for the piece type of the mover as well as to the occupancy board for that color.
That's not as easy as it sounds. Every time I try that I have issues with pins, discovered checks and ent passants. An enemy check really throws a monkey wrench the works. If I can get it to work without issues I figure to double the speed of my move generator.
-
- Posts: 28395
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: design choices
What you mention are all issues of move generation. They have nothing to do with updating the board position.
But I am not trying to convince you to use bitboards. Mailbox methods can be so much faster. It is just that you do seem to use them already, in a way nobody else does, seemingly just to create extra overhead.
But I am not trying to convince you to use bitboards. Mailbox methods can be so much faster. It is just that you do seem to use them already, in a way nobody else does, seemingly just to create extra overhead.
-
- Posts: 313
- Joined: Tue Aug 03, 2021 2:41 pm
- Full name: Bill Beame
Re: design choices
I think you hit it, my engine started from a mailbox form. However, my move generation is PEXT bitboards. Nothing is faster from everything I tried. It increased my move generation by over 100x, so, I must have had a very weak mailbox algorithm. I'm in the process of redesigning my move generation to a bitboard type solution per your suggestion. There are huge sections of the code which still depend on that Piece & board list which solved all my discovered check, pins, et passant. and pawn promotion issues. Doing that with bitboards is going to be a real challenge for me. but, 2x or 3x increase in speed would put me in the 2 - 3,MM/nps range. That's probably not too bad for a 1 core i7. thx for all your suggestions.hgm wrote: ↑Sat Oct 22, 2022 8:42 pm What you mention are all issues of move generation. They have nothing to do with updating the board position.
But I am not trying to convince you to use bitboards. Mailbox methods can be so much faster. It is just that you do seem to use them already, in a way nobody else does, seemingly just to create extra overhead.