Opening book implementation questions

Discussion of chess software programming and technical issues.

Moderator: Ras

pedrojdm2021
Posts: 157
Joined: Fri Apr 30, 2021 7:19 am
Full name: Pedro Duran

Re: Opening book implementation questions

Post by pedrojdm2021 »

phhnguyen wrote: Thu Jun 24, 2021 8:17 am
pedrojdm2021 wrote: Thu Jun 24, 2021 7:04 am I undestand, but, how can i know a score from a move from a opening book generated from a PGN file? by calling evaluate() ?
No, it’s not kind of positional score but game score. Say, a none-draw game gives the winner 2 point, a draw gives him 1 point and the loser gets nothing. Thus you don’t need to use any engine. Just retrieve the game result from the PGN then add 2 or 1 or 0 (according to win/draw/loss)to every moves of opening line which extracted from that game.

It’s a kind of voting: an opening line from a won game should be better than one from a lost game, thus it (and all moves of that line) should be voted up.

Note that win/loss is the view from player’s side - you should take care about the side too. One opening line from a win game is good for white side but bad for black side and so on. Building one book is OK but it’s better to build two independent opening books and which one will be used depending on what side your engine is playing.
Ohh that sounds great :D i now understand, thank you very much for your help :) , when i finish improving the evaluation of my engine i will continue working on the book feature, maybe when i get more progress on it, i will share the results here :)