How to use openings books?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

How to use openings books?

Post by Luis Babboni »

Thats!

My engine Soberango never uses opening book and seems this is the reason sometimes crash if the settings obligate the engine to use it.

I look for it in http://hgm.nubati.net/CECP.html where are the xBoard commands and couldn´t find about it.
Well, I found this but or I do not understand it or is not what I looking for:

"bk
[advanced] Invites the engine to send a number of text lines starting with a Space or Tab character to the GUI, terminated by an empty line, for display as a table to the user. Intended for book or tablebase moves the engine has available in the current position."


Any hint?

Thanks!
Dann Corbit
Posts: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: How to use books?

Post by Dann Corbit »

If your engine can start a game from a future position, it should work with a book.

Can you run games starting from something like this:


[Event "1. hxg6!!"]
[Site "?"]
[Date "2010.10.28"]
[Round "?"]
[White "Euxinus Pontus no.13, Bxg6"]
[Black "?"]
[Result "*"]
[SetUp "1"]
[FEN "7q/b1p5/1p1Npkb1/pPP2ppP/P1P5/3B2P1/5P1R/K3R3 w - - 0 1"]
[PlyCount "43"]
[EventDate "2010.??.??"]

*
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: How to use books?

Post by Luis Babboni »

Thanks Dann!

No, just from the begining!

But is able to read a FEN, what do the subroutine I did to comunicate Soberango with the GUI is this:

Code: Select all

If DiceGUI="new" Then
  	Reseteo
  	FEN="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"		
  	CargaFEN(FEN)
EndIf
Where:
-DiceGUI is the command sent by the GUI.
-Reseteo clean the board and restore all variables.
-CargaFEN() read the FEN and set the apropiate variables.

Sorry, not sure if my question is correct:
After wich command instead of "new" must the engine read the FEN?
Last edited by Luis Babboni on Mon Jul 25, 2016 11:07 pm, edited 1 time in total.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: How to use openings books?

Post by hgm »

When using a GUI book the engine gets the bookbmoves sent to it by the GUI in 'force' mode. I.e. irrespective of whether the engine is going to play black or whiteit will be sent a 'force' command to make it play neither side, and then a number of moves will be sent to it as long as the game stays in book. Once you run out of book, and it is the engine's turn, it will receive a 'go' command to set it thinking.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: How to use openings books?

Post by Luis Babboni »

hgm wrote:When using a GUI book the engine gets the bookbmoves sent to it by the GUI in 'force' mode. I.e. irrespective of whether the engine is going to play black or whiteit will be sent a 'force' command to make it play neither side, and then a number of moves will be sent to it as long as the game stays in book. Once you run out of book, and it is the engine's turn, it will receive a 'go' command to set it thinking.
That means is not the engine who choice between differents options the book have? Is the GUI who selected the path by the book? :shock:
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: How to use openings books?

Post by hgm »

Indeed. That is how a GUI book works. The GUI selects an opening line from the book, and feeds it to the engines before setting them playing.

If you want the engine be in control of what book moves it selects, it should handle a book itself. This would be something the GUI is notinvolved in, and knows nothing about. The engine is free to decide what method it uses to find a move, when its turn comes up. It can use search and evaluation,or it could just read the move from a file.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: How to use openings books?

Post by Luis Babboni »

hgm wrote: ...
If you want the engine be in control of what book moves it selects, it should handle a book itself. This would be something the GUI is notinvolved in, and knows nothing about. The engine is free to decide what method it uses to find a move, when its turn comes up. It can use search and evaluation,or it could just read the move from a file.
That´s how I guessed all engines works, but today Soberango was start tested to be add to CCRL 40/4 Rank and crashes because is not able to start a game after some moves made by Arena GUI using its openings book

That´s why I start thinking in add the ability to use openings book that I was planed for future after quiescence search, hashtables and tablebases and mostly after improving the evaluation cause actually just count material and then has no sense the choice of one or other move in opening if no implies material difference.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: How to use openings books?

Post by Luis Babboni »

After the GUI ends to read the opening book, it will send to the engine a FEN with the position reached or the engine must actualize its variables after each move made by the GUI from its book while in force mode?
Last edited by Luis Babboni on Tue Jul 26, 2016 12:05 am, edited 1 time in total.
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: How to use openings books?

Post by cdani »

Luis Babboni wrote:
That´s how I guessed all engines works, but today Soberango was start tested to be add to CCRL 40/4 Rank and crashes because is not able to start a game after some moves made by Arena GUI using its openings book
If your engine is uci and supports the uci command
position startpos moves e2e4 e7e5
it should work.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: How to use openings books?

Post by Luis Babboni »

cdani wrote:
Luis Babboni wrote:
That´s how I guessed all engines works, but today Soberango was start tested to be add to CCRL 40/4 Rank and crashes because is not able to start a game after some moves made by Arena GUI using its openings book
If your engine is uci and supports the uci command
position startpos moves e2e4 e7e5
it should work.
Thanks Daniel!
Soberango uses xBoard*
But anyway I´m not understand your suggestion.
You mean that read GUI information gives to the engine while move using its book and transform it to this to set the apropiate position in the engine board?

*: when I say that uses xBoard, is not that I take the pseudocode showed in http://hgm.nubati.net/CECP.html and use it to write a complete xboard interfase in FreeBasic. The communication Soberango have with GUI is just using the minimum commands I saw I need to run it and all other are simply ignored.