topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday September 21, 2020, 4:07 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Polyglot Zobrist Key Generator  (Read 2302 times)

shinkarom

  • Member
  • Joined in 2014
  • **
  • default avatar
  • Posts: 12
    • View Profile
    • Donate to Member
Polyglot Zobrist Key Generator
« on: November 24, 2019, 02:56 AM »
https://shinkarom.github.io/zobrist/
When writing a chess engine, you might want to support opening books in Polyglot bin format. This format creates the hash for the position using Zobrist hashing. If you want to debug your hash generator, I haven't found any services that can generate hash from the position.
So I wrote one. You paste the position as FEN and get the resulting hash.

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,640
    • View Profile
    • Donate to Member
Re: Polyglot Zobrist Key Generator
« Reply #1 on: February 08, 2020, 03:24 PM »

Wow, this is beyond my level to use, but I'm psyched to see a Chess Nany Entry!

I did a PGN processor and got mouser's permission because it was custom commissioned and not shared elsewhere.

Some notes for the DC Crowd:

- FEN stands for "Forsyth Edwards Notation", which is a text way to describe a position in chess. The basic idea is line by line, it contains data like "Rook, 2 spaces Queen 2 spaces King / Next Line" and some notes like whose move it is and whether things like castling or en passant are legal.

- An "Opening book" means a chess program first looks for known positions in its "book" or library, to see what might be a good move to try, rather than trying to figure it out from scratch. The basic idea is that for a set position, "there's a severe risk the computer won't understand to do x or y as good choices, but instead plays move Q which leads to a bad or even losing position".  So I think I understand this Nany to add misc positions themselves into the book. So I think the Caro Kann opening has some famous endgame, and you could put that in there, so even if it didn't have twenty hours of work with the full move set to get there, suddenly if the computer spots that the specific position showed up, "oh, I should do this here".

Neat!

shinkarom

  • Member
  • Joined in 2014
  • **
  • default avatar
  • Posts: 12
    • View Profile
    • Donate to Member
Re: Polyglot Zobrist Key Generator
« Reply #2 on: February 09, 2020, 05:48 AM »
My intended use is much simpler.
When you're writing an engine, most opening books are in the Polyglot format (.bin). The positions in the book are encoded with Zobrist hashing (https://www.chesspro....org/Zobrist_Hashing). So to check if the position is present in the book, you first need to hash it. And because Murphy's law states that "it's bug-ridden and broken from the start", you need to debug your hashing somehow, ideally comparing with some other generator.
I couldn't find anything to debug my hashing while writing Mussaurus (http://www.talkchess....php?f=2&t=72372), so I wrote my own generator.