View Single Post
Old 2021-09-16, 19:34   #14
M344587487
 
M344587487's Avatar
 
"Composite as Heck"
Oct 2017

87010 Posts
Default

Had a bit of a noodle again with this project. After cursing at past me for creating such an awful spider's nest of code the core engine has been re-implemented to fully use u64 bitboards (before the pieces were stored as u8 positions with bitboards only used partly). The new implementation is at least 10x quicker at generating moves and hasn't been fully optimised yet so that's a win. It makes heavy use of code like this:
Code:
while(piece_type){
  index=__builtin_ctzll(piece_type);//bitscan
  //test piece
  piece_type^=(1ull<<index);//pop
}
to pop the positions of all pieces of a certain type to do tests with (the tests use precomputed masks where possible). The implementation only uses basic bit manipulation as I don't know the more advanced concepts, but there's also the possibility of parallelising part of this implementation to AVX2 which may not be as easy with a more complex representation. AVX2 is a tempting rabbit hole even if it's not the best way forwards.

If compression is ever touched on again the first port of call will probably be storing the entire set as a de-duplicated n-ary tree using dwarf's representation which seems neat ( https://eli.thegreenplace.net/2011/0...thm-from-dwarf ). Then it's probably back to trying to cheaply rank moves in a position to make them more compressible.

The nest of code still exists, it's just been added to so that future me has a reason to drink.
M344587487 is offline   Reply With Quote