Hallo together
I have my program named Stellar,it now plays FIDE chess,
Stellar ist my first schach program,i read the TSCP code & the book code of Stellar that i use now ist inspired from the TSCP code,
The code ist complete rewriten but the book ist like TSCP to get idea,i mean text file with moves 'd2d4' etc,
I am now thinking of moving to better opening book code,
my questions ist what ist the ways that you people do?
what ist the suggested method to do opening book code?I work in ANSI-C
Danke,
Robert
opening book coding
Moderators: hgm, Rebel, chrisw
-
- Posts: 4675
- Joined: Mon Mar 13, 2006 7:43 pm
Re: opening book coding
Most authors use a hash of a given position to access the opening book. The book is organized as a transposition table (indexed by hash code) or a tree (also indexed by hash code). Each entry in the table (or tree) contains:
1) The win/lose/draw statistics for the position
Or,
2) A list of moves for the position, with each move having its own win/lose/draw statistics.
1) The win/lose/draw statistics for the position
Or,
2) A list of moves for the position, with each move having its own win/lose/draw statistics.
Re: opening book coding
Hallo Steffen,
Danke for the reply,i understood that..
Book ist like presaved hash table which have moves stored,like hash,which i access by probe code like for hash tables?
I have some questions,please..
1)Ist it enough to just store win/loss/draw statistics for position? i think point 2 ist better.
2)ist it enough to have only win/loss/draw statistics & ist it completely trustable with the method?
Ist it a good idea to have a shallow alpha-beta search into best x moves?
Danke,
Robert
Danke for the reply,i understood that..
Book ist like presaved hash table which have moves stored,like hash,which i access by probe code like for hash tables?
I have some questions,please..
1)Ist it enough to just store win/loss/draw statistics for position? i think point 2 ist better.
2)ist it enough to have only win/loss/draw statistics & ist it completely trustable with the method?
Ist it a good idea to have a shallow alpha-beta search into best x moves?
Danke,
Robert
-
- Posts: 670
- Joined: Mon Dec 03, 2007 3:01 pm
- Location: Barcelona, Spain
Re: opening book coding
There exist different implementations.Robert Bernhard wrote:Hallo Steffen,
Danke for the reply,i understood that..
Book ist like presaved hash table which have moves stored,like hash,which i access by probe code like for hash tables?
I have some questions,please..
1)Ist it enough to just store win/loss/draw statistics for position? i think point 2 ist better.
2)ist it enough to have only win/loss/draw statistics & ist it completely trustable with the method?
One way to go is to let the opening book be automatically generated. Therefor you scan through your game database and add each new move played to the opening book and increase one of 3 counters (win/draw/loss). When finally using the opening book you have to come up with a formula to state the probability a certain move is chosen. This should take into account the outcomes of the games as well as the size of the sample (more people playing a certain move is usually a better option)
Another way to go would be to edit/create your book manually. There it would be enough to just fill the book with entries consisting of <hash> + <move>. Thus for each position you might have several of these pairs. You can as well add another variable: "weight" to set which of the moves should be prefered.
Opening books are all about avoiding to start searches (and waste time) too early. It is in the interest of the opening book author to make the lines strong enough so that no search is needed afterwards.Robert Bernhard wrote: Ist it a good idea to have a shallow alpha-beta search into best x moves?
-
- Posts: 670
- Joined: Mon Dec 03, 2007 3:01 pm
- Location: Barcelona, Spain
Re: opening book coding
Storing statistics per move is always superior than storing it per position.sje wrote:Most authors use a hash of a given position to access the opening book. The book is organized as a transposition table (indexed by hash code) or a tree (also indexed by hash code). Each entry in the table (or tree) contains:
1) The win/lose/draw statistics for the position
Eg.
1. e4 e5 2. Bb5 a6 3. Nf3
Most opening books that store per position statistics would play Nc6?? here, just because it sees the transposition into the spanish opening and doesn't know the position after axb5!
Re: opening book coding
Hallo,
Thankes of you!
Ed this ist nice,i will use your code for now,
but eventually i want to work out my book code,because ist may be a problem for some tournament?
thankes all!
Robert
Thankes of you!
Ed this ist nice,i will use your code for now,
but eventually i want to work out my book code,because ist may be a problem for some tournament?
thankes all!
Robert
Re: opening book coding
There is no tournament problem, it's an open system. The format comes with its own book-editor, see: http://www.top-5000.nl/prodeodos.htmRobert Bernhard wrote:Hallo,
Thankes of you!
Ed this ist nice,i will use your code for now,
but eventually i want to work out my book code,because ist may be a problem for some tournament?
thankes all!
Robert
Ed
Re: opening book coding
Danke Ed,
I am implementation of yours code for book usage.
Very helpful,it save me a coding for book myself.
MfG,
Robert
I am implementation of yours code for book usage.
Very helpful,it save me a coding for book myself.
MfG,
Robert
-
- Posts: 287
- Joined: Sat Mar 11, 2006 3:19 am
- Location: Atlanta, GA
Re: opening book coding
Requiring the current position to exist in the book before using book moves should fix this problem. In addition, storing statistics per position doesn't loose information for different moves that come to the same position.Codeman wrote: Storing statistics per move is always superior than storing it per position.
Eg.
1. e4 e5 2. Bb5 a6 3. Nf3
Most opening books that store per position statistics would play Nc6?? here, just because it sees the transposition into the spanish opening and doesn't know the position after axb5!