This was a rough day. Initializing complicated data structures is I think the hardest part of programming. And I'm sure the way I did it made it even harder. I was only able to initialize the vSuperset[sq][vIndex] array. It did test good in the debugger. I got the variable names a little bit confused but I'll correct those tomorrow.
This code takes a vIndex and rotates it to the aFile then << (sq & 7) x. After the vertical occ is in place two for loops search from sq looking for blockers while or-ing bits into vSuperset[sq][vIndex]. I could not find out how to do a reverse kindergarten rotation. The CPW is not very strong on initializing tables.
Mike Sherwin wrote: ↑Wed Jan 04, 2023 9:43 am
This was a rough day. Initializing complicated data structures is I think the hardest part of programming. And I'm sure the way I did it made it even harder. I was only able to initialize the vSuperset[sq][vIndex] array. It did test good in the debugger. I got the variable names a little bit confused but I'll correct those tomorrow.
This code takes a vIndex and rotates it to the aFile then << (sq & 7) x. After the vertical occ is in place two for loops search from sq looking for blockers while or-ing bits into vSuperset[sq][vIndex]. I could not find out how to do a reverse kindergarten rotation. The CPW is not very strong on initializing tables.
I renamed some variables so the code can be more easily understood. And a couple of bugs were fixed. All four corners and e4 were tested. It worked perfectly for those squares. I hope it is bug free now.
Here is the initialization for the rank attacks. Tonight I realized that supersets are not required in this version of the move generator. The final return would the be, return vPartialSet[sq][vIndex] | hPartialSet[sq][hIndex];
And I'll have to change the name of the move generator to Kindergarten Split Index Partial Set Yielding bitboards, SIPSY bitboards.
It took me two whole days working every waking hour to write the code to initialize the diagonal look up tables. I had to change my thinking to get it right. The anti diagonal is exactly similar except it has +- 7 instead of +-9. Also to be consistent I'm going to rewrite the rank and file tables. It is really quite different now. The index as blockers were being placed (or I was trying to anyway) into u64 blockers;. That was totally not necessary! Just, if (docc & (1 << (ts & 7))) break;, was easy enough! And it took hours and hours to realize that the test in the for loops cannot be done first. That means I should have used a do loop. But now that they are done I kind of like it the way it is. And now that the battle of initialization has been won my new move generator code should be done by tomorrow!
Henk wrote: ↑Wed Jan 11, 2023 10:05 pm
O wait you probably update the score per move.
When the move list is created the moves are scored by their PSQTs for move ordering. And for performing a shallow search on the remaining moves. If depth > 3 play a move then call search with depth 1 to give each move a score.
I took a break for a couple days because nothing ever works the first time and I was too stressed after completing the initialization to deal with any more stress right away. Today I risked it and put the new bishop move generator in Bricabrac as it is already a working engine that passes all perft test. And it worked first time! Unbelievable, Here is all the applicable code as it is in Bricabrac.