
http://talkchess.com/forum3/viewtopic.php?p=838101#p838101

Polyglot (.bin) books are just a list of all the moves of the book sorted by position. For each move 16 bytes of data are stored:

* An 8-byte hash key represents the position
* a 2-byte integer represents the move, as toSquareNumber + 64*fromSquareNumber + 4096*promotionPiece
* a 2-byte interer known as the weight (determining the relative probability the move will be chosen)
* two 2-byte numbers known as the 'learn fields', only used for 'book learning' (where they hold the number of plays and number of scored half-points)

The hash key is a normal Zobrist XOR key; the list of basis keys can be obtained from the Polyglot or XBoard source code. The moves are sorted in the order of ascending key (interpreted as unsigned integer).

The promotionPiece is 0 when the move is not a promotion, or 1-4 for N, B, R, Q respectively.

Squares are numbered 0 (for a1) to 63 (h8), with a8 -> 7.
