I'm implementing Polyglot using the info here: http://hgm.nubati.net/book_format.html
That page makes mention of a backwards-compatible extension whereby any of the castling rights B,C,D,E,F,G,b,c,d,e,f,g would each generate an additional xor onto the Zobrist hash of the position.
Are there accepted values somewhere to use for the xor? The guide just has "to be filled in".
Thanks.
Values for Polyglot c960 zobrist hashing?
Moderators: hgm, Rebel, chrisw
-
- Posts: 30
- Joined: Mon May 11, 2020 11:52 am
- Full name: Allan Thomas
-
- Posts: 27825
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Values for Polyglot c960 zobrist hashing?
This format description was just something I copied, and added some paragraphs to for how to extend to variants with larger boards or more pieces types. I never noticed this Chess960 stuff. I had a peek at XBoard's book code, and nothing special is done in the case of FRC: XBoard just uses the normal castling keys, corresponding to the K and Q qualifiers in X-FEN. There is no separate way to encode positions which would have B...G qualifiers in X-FEN, and XBoard would even probe the wrong position in that case.
I can think of a solution on the spot, though: just multiply the K and Q keys by the number of squares the inner Rook that has the castling rights is removed from the corner. So for Q-side castling with a c-Rook you would use 3*Qkey etc.
I can think of a solution on the spot, though: just multiply the K and Q keys by the number of squares the inner Rook that has the castling rights is removed from the corner. So for Q-side castling with a c-Rook you would use 3*Qkey etc.
-
- Posts: 30
- Joined: Mon May 11, 2020 11:52 am
- Full name: Allan Thomas
Re: Values for Polyglot c960 zobrist hashing?
OK thanks.
I think I misunderstood the original idea, I was just going to have a total of 16 zobrist xor values, one for every possible castling right A-H and a-h (with KQkq in normal chess being HAha).
But if there's no standard I'll feel free to ignore the issue.
I think I misunderstood the original idea, I was just going to have a total of 16 zobrist xor values, one for every possible castling right A-H and a-h (with KQkq in normal chess being HAha).
But if there's no standard I'll feel free to ignore the issue.
-
- Posts: 27825
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Values for Polyglot c960 zobrist hashing?
Well, basically my idea is similar. Except that it also exactly says what these values for the new keys are (namely N times the plain castling key). And in such a way that you don't need extra table elements to remember those.