Page 1 of 1

Book

Posted: Tue Dec 20, 2011 3:35 pm
by geko
is this technique valid to create a book?

example from this pgn:
1. d4 Nf6 2. c4 g6 3. Nc3 d5 4. Nf3 Bg7 5. cxd5 Nxd5 6. e4 Nxc3 7. bxc3 c5 8.
Be3 Qa5 9. Qd2 Nc6 10. Rc1 cxd4 11. cxd4 Qxd2+ 12. Kxd2 O-O 13. d5 Rd8 14. Ke1
Ne5 15. Nxe5 Bxe5 16. f4 Bd6 17. Kf2 e5 18. Bc5 Bxc5+ 19. Rxc5 exf4 20. Kf3 Bd7
21. Bd3 Rac8 22. Rhc1 g5 23. Rc7 Rxc7 24. Rxc7 Ba4 25. Kg4 h6 26. Rxb7 Rd7 27.
Rb4 Bd1+ 28. Kf5 Kg7 29. h4 f6 30. hxg5 hxg5 31. e5 fxe5 32. Kxe5 f3 33. gxf3
Bxf3 34. d6 Rd8 35. Bf5 Bc6 36. d7 Rf8 37. Rd4 1-0

use "pgn2epd.exe" to generate all moves from a strong pgn

pgn2epd output:

(1)rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - bm d4;
(2)rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - bm Nf6;
(3)rnbqkb1r/pppppppp/5n2/8/3P4/8/PPP1PPPP/RNBQKBNR w KQkq - bm c4;
etc.

Create a zobristKey-hashtable where at position (1) the best move is d4, at position (2) the best move is Nf6, at position (3) the best move is c4, etc.

before to start alphaBeta search look in hashtable

thank you
g.

Re: Book

Posted: Tue Dec 20, 2011 11:02 pm
by hyatt
That will work but is clumsy. Most just suck in the games one at a time, and spit the Zobrist keys back into a file. You spit the key from the position BEFORE the move is made, then attach the move to the key, and then figure out some reasonable way to access the information quickly. Hash table will work for small books until you start to get overwrites when you have too many book positions.