The idea is to substitute lookup with addition/subtraction. I tried implementing this in double push, but there seems to be a bug somewhere in my logic.
hgm wrote: ↑Sun Apr 26, 2020 5:09 pm
Micro-Max doesn't bother to hash the castling rights.
How does that work?
You just accept that it confuses position with and without castling rights that are otherwise the same, on hash probes. Almost never happens anyway, and if it does, so what?
hgm wrote: ↑Mon Apr 27, 2020 6:59 pmYou just accept that it confuses position with and without castling rights that are otherwise the same, on hash probes. Almost never happens anyway, and if it does, so what?
Nearly the same here, except that I verify the hash move for pseudo legality, including castling rights if the move is castling. I treat the lookup as failed if the move doesn't pass this test. Full legality is checked later, not in the hash lookup.
I guess it helps that in micro-Max castling can never be a hash move. Castlings and double-pushes need to pass an e.p. square to the daughter, and what that square is can only be known if the move generator generates them, not when they come from the hash table. So they cannot be allowed to become hash move, which is realized by storing them with a recognizably invalid toSquare in the hash table when they end up as best move. Move generation always starts with the piece on the fromSquare of the hash move, though, and castlings would be the first King moves it generates, when these are allowed. (And in Fairy-Max double pushes are the first move it generates on a Pawn). So it isn't a big problem; occasionally it would start trying the wrong castling. But in a node without castling rights the castling would not be generated.