Gnuchess book

Discussions about Winboard/Xboard. News about engines or programs to use with these GUIs (e.g. tournament managers or adapters) belong in this sub forum.

Moderator: Andres Valverde

Gnuchess book

Postby matrix101 » 28 Apr 2014, 20:33

Hello!

I built gnuchess 6.1.1 from source, all the files in gnuchess folder. I can use it with xboard using the following command:

Code: Select all
xboard -fcp 'gnuchess --xboard'


I only need book, which source code I saved from here: http://ftp.gnu.org/gnu/chess/ (As far as I know gnuchess 6.1.1 doesn`t contain book by itself)
Then I moved the gz-file to the gnuchess folder and extracted there.

The question: how to use the book with gnuchess?

I found some instructions but none how to proceed:

Handle the book. Requires a subcommand:

add - compiles book.bin from book.pgn

on - enables use of book

off - disables use of book

best - play best move from book .......
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Re: Gnuchess book

Postby H.G.Muller » 28 Apr 2014, 20:47

I don'tknow much about GNU Chess 6. I thought it was a re-branded Fruit, combined with Polyglot into one binary. Fruit does use books in Polyglot format, and Polyglot can use these too. What format has the book that you downloaded? Is that a PGN file? If so, I suppose you have to follow the instructions given in the GNU Chess docs to convert it to bin.

Note that XBoard can also use Polyglot books as GUI book. You should enable and specify the (.bin) book file in the Common Engine Options dialog, and untick that the engine has an own book, to make XBoard use the GUI book on its behalf.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Gnuchess book

Postby matrix101 » 29 Apr 2014, 13:57

This is quite strange. When I go to https://www.gnu.org/software/chess/manual/gnuchess.html#Invocation and continue to the book section there is said:

Code: Select all
--addbook filename
-a filename


Compile book.bin from pgn book ’filename’ and quits.

To your original question, yes, the book file I downloaded is pgn. I actually have gnuchess-6.1.1 and book_1.02pgn inside gnuchess directory which is located in Home.

I don`t think I need polyglot to convert pgn into bin. The above-posted code doesn`t work for me for example:

--addbook gnuchess/book_1.02.pgn
--addbook: command not found
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Re: Gnuchess book

Postby H.G.Muller » 29 Apr 2014, 14:33

Well, of course that does not work. The manual describes those as options to gnuchess, and you use them as if the were independent commands. You would have to type something like

gnuchess --addbook ...

Note thet GNU Chess 6 contains a Polyglot, and that it is likely that it uses that to execute this command.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Gnuchess book

Postby matrix101 » 29 Apr 2014, 16:16

Yes now worked.

$ gnuchess --addbook gnuchess/book_1.02.pgn
GNU Chess 6.1.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
White (1) : inserting games ...
allocating 1,5MB ...
allocating 3MB ...
allocating 6MB ...
allocating 12MB ...
allocating 24MB ...
10000 games ...
allocating 48MB ...
20000 games ...
30000 games ...
allocating 96MB ...
40000 games ...
50000 games ...
60000 games ...
70000 games ...
allocating 192MB ...
80000 games ...
90000 games ...
100000 games ...
110000 games ...
120000 games ...
130000 games ...
140000 games ...
145716 games.
7920490 entries.
filtering entries ...
180358 entries.
sorting entries ...
saving entries ...
all done!

gnuchess -a gnuchess/book_1.02.pgn
GNU Chess 6.1.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
White (1) : inserting games ...
allocating 1,5MB ...
allocating 3MB ...
allocating 6MB ...
allocating 12MB ...
allocating 24MB ...
10000 games ...
allocating 48MB ...
20000 games ...
30000 games ...
allocating 96MB ...
40000 games ...
50000 games ...
60000 games ...
70000 games ...
allocating 192MB ...
80000 games ...
90000 games ...
100000 games ...
110000 games ...
120000 games ...
130000 games ...
140000 games ...
145716 games.
7920490 entries.
filtering entries ...
180358 entries.
sorting entries ...
saving entries ...
all done!

There is another issue though. I think GNUChess is default engine in xboard and when I type xboard -fcp 'gnuchess --xboard' system opens xboard with GNUChess. I don`t know if the GNUChess source I compiled has anything to do with my current GNUChess engine with xboard.

If I want to use my self-compiled GNUChess how? It is important to be able to use source-compiled engines with xboard. The book is also not working in my current GNUChess engine. Now it should be in bin format?
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Re: Gnuchess book

Postby H.G.Muller » 29 Apr 2014, 16:56

If you did "sudo make install" then the GNU Chess you compiled should have become the default GNU Chess on your system. It is not really true that this replaced the original GNU Chess. Debian uses the convention that binary packages from the repositories are in installed in /usr (in this case /usr/games/guchess), while software you compile from source is installed in /usr/local (in this case /usr/local/games/gnuchess). But because /usr/local/games is in your shell's search path before /usr/games, the things you installed from source 'eclipse' the corresponding files that came with the distro. So as long as your self-compiled stuff is there, the original stuff might as well have been deleted. But when you remove your self-compiled stuff, the original stuff becomes active again.

This only holds if you installed, because only 'make install' ill move the binaries and their data files to the place where they belong. If you topped at 'make', the gnuchess binary will still sit in the directory here you 'maked' it. Typing 'gnuchess' at the command prompt (and also when XBoard issues it) would then invoke the original version of GNU Chess, as /usr/games is searched before the current directory, and the latter is only searched when you would type ./gnuchess. (And if you are no longer in the directory where gnuchess is, it could not be found at all, unless you specify the path to it.)

Note that not all engines might be compliant with these conventions, but since GNU Chess is coming from the Ubuntu repositories, I suppose it is. (But be careful with engines that are basically just hacked Windows versions; they are often made by people that don't know where one should put files on Linux, and could put them in the strangest places.)

I don't know what you have to do to make GNU Chess use its own book, and where it looks for it by default. (One would expect something like /usr/local/share/games/gnuchess/*.bin .) As I said, I never used GNU Chess 6.

Note that the default engine of XBoard is not gnuchess, but fairymax. But this merely means that giving a plain "xboard"command is the same as typing "xboard -fcp fairymax -scp fairymax". XBoard only knows the default engine by name, and issues that name a a command, not making any attempt to control what the system does with it. So it is not like XBoard has some secret path to the default engine that would make it use anything else than what you would get when you typed 'fairymax' at the command prompt in a terminal window.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Gnuchess book

Postby matrix101 » 29 Apr 2014, 18:40

OK or more simply

Code: Select all
xboard -fcp 'gnuchess --xboard'


Would execute xboard together with GNUChess from the xboard package and

Code: Select all
xboard -fcp './gnuchess--xboard'


Would execute xboard together with GNUChess that I built from source.
However I get error when I put the latter one as command. The system can`t find my self-compiled version.

"I don't know what you have to do to make GNU Chess use its own book, and where it looks for it by default".

Actually I do. If one opens text editor and searces gnuchess.ini file one can see as follows:

Log = false # set to true for bug reports
LogFile = adapter.log

Resign = true
ResignMoves = 1 # 1 is safe for Fruit

Book = false
BookFile = smallbook.bin

[Engine]

# standard UCI options

Hash = 256 # in MB

NalimovCache = 16 # in MB

OwnBook = false # false for no book (e.g. Nunn-like matches)
BookFile = smallbook.bin
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Re: Gnuchess book

Postby H.G.Muller » 29 Apr 2014, 19:37

matrix101 wrote:OK or more simply

Code: Select all
xboard -fcp 'gnuchess --xboard'


Would execute xboard together with GNUChess from the xboard package and

There is no GNU Chess in the xboard package. Just XBoard.

Code: Select all
xboard -fcp './gnuchess--xboard'


Would execute xboard together with GNUChess that I built from source.
However I get error when I put the latter one as command. The system can`t find my self-compiled version.

You left out the space before the --. So the systems looks for a file named gnuchess--xboard, which is not there. (Not in the current directory, and not anywhere.)

"I don't know what you have to do to make GNU Chess use its own book, and where it looks for it by default".

Actually I do. If one opens text editor and searces gnuchess.ini file one can see as follows:

Log = false # set to true for bug reports
LogFile = adapter.log

Resign = true
ResignMoves = 1 # 1 is safe for Fruit

Book = false
BookFile = smallbook.bin

[Engine]

# standard UCI options

Hash = 256 # in MB

NalimovCache = 16 # in MB

OwnBook = false # false for no book (e.g. Nunn-like matches)
BookFile = smallbook.bin
[/quote]
Indeed, that could be it. Note you have the choice to specify a book in the Polyglot section (in which case the built-in Polyglot would use it), or in the [Engine] section (where Fruit would use it itself).
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Gnuchess book

Postby matrix101 » 29 Apr 2014, 20:42

Code: Select all
xboard -fcp './gnuchess --xboard'



-> Failed to start first chess program ./gnuchess --xboard on localhost: ./gnuchess: Permission denied
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Re: Gnuchess book

Postby H.G.Muller » 29 Apr 2014, 21:27

'Permisson denied' suggests that the file exists, but that it is not executable. Can you post the output of an "ls -l" command in that directory here?
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Gnuchess book

Postby matrix101 » 30 Apr 2014, 12:23

Code: Select all
ls -l ./gnuchess
total 110048
-rw-r--r-- 1 user user 85712190 huhti 28 22:13 book_1.02.pgn
-rw-r--r-- 1 user user 26265281 huhti 28 22:08 book_1.02.pgn.gz
drwxr-xr-x 7 user user     4096 huhti 28 18:51 gnuchess-6.1.1
-rw-r--r-- 1 user user   699439 huhti 28 18:44 gnuchess-6.1.1.tar.gz
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Re: Gnuchess book

Postby matrix101 » 30 Apr 2014, 13:30

Ok I somewhat progressed...

Code: Select all
xboard -fcp './gnuchess/gnuchess-6.1.1/src/gnuchess --xboard'


I determined the full path to GNUChess executable. Now I should have GNUChess which I built from source?

The book is also not yet working.

Book

Default: false

Indicates whether the adapter should use a book. This has no effect on the engine own book (which can be controlled with the UCI option OwnBook in the [Engine] section). In particular, it is possible to use both a PolyGlot book and an engine book. In that case, the engine book will be used whenever PolyGlot is out of book. Remember that PolyGlot is unaware of whether the engine is itself using a book or not.

Now I have the settings as follows in the ini file:

Book = true
BookFile = smallbook.bin

[Engine]

# standard UCI options

Hash = 256 # in MB

NalimovCache = 16 # in MB

OwnBook = true # false for no book (e.g. Nunn-like matches) I changed false to true now it should work regarding smallbook.bin exists (it does in src folder) but it doesn`t work
BookFile = smallbook.bin
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Re: Gnuchess book

Postby H.G.Muller » 30 Apr 2014, 15:59

I think the problem is that GNU Chess (both its engine and Polyglot component) interprets the file name you give for the book relative to the current directory. And that is apparently not where it is, considering the fact that you have to specify a long path name for the binary.

So you either must also give a path name for the book files, or make sure that the directory where gnuchess and smallbook.bin are located is the current directory. The latter you can do by first go there and only then start XBoard:

cd ./gnuchess/gnuchess-6.1.1/src
xboard -fcp ./gnuchess

or tell XBoard that it should start the engine from another directory

xboard -fcp ./gnuchess -fd ./gnuchess/gnuchess-6.1.1/src
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Gnuchess book

Postby matrix101 » 30 Apr 2014, 16:47

The latter command works for me. Optionally, I could use something like Home/user/gnuchess/gnuchess-6.1.1/src/smallbook.bin in the book file. Then I could invoke xboard with

Code: Select all
xboard -fcp './gnuchess/gnuchess-6.1.1/src/gnuchess --xboard'


It would be unclear if it worked at all. Not for me.

Code: Select all
xboard -fcp ./gnuchess -fd ./gnuchess/gnuchess-6.1.1/src


Now the engine and book are invoked from the same directory at least.

Connecting to ics is another issue though. Didn`t work for me.

Code: Select all
 xboard -fcp ./gnuchess -fd ./gnuchess/gnuchess-6.1.1/src -zp -ics freechess.org


xboard: Unrecognized argument -zp
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Re: Gnuchess book

Postby H.G.Muller » 30 Apr 2014, 22:33

I think zippy is not included by default when you compile XBoard. You would have to give some flag with ./configure for that Like

./configure --enable-zippy

Then it will recognize the -zp option.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Gnuchess book

Postby matrix101 » 01 May 2014, 10:47

Code: Select all
 ./configure --enable-zippy


bash: ./configure: No such file or directory
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Re: Gnuchess book

Postby H.G.Muller » 02 May 2014, 08:05

Since you were building the engines from source I also assumed that you had been building XBoard from source, and knew how to do it. Perhaps this was a bit rash.

You have to

1) make sure the XBoard source code is on your machine
2) cd to where it is
3) then issue the ./configure command

(If you obtained the sorurce directly from a git repository, rathther than a distribution tar ball, you might have to do ./autogen.sh before you can do ./configure, to create the latter.)
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Gnuchess book

Postby matrix101 » 02 May 2014, 08:58

Code: Select all
cd xboard/xboard-4.7.2
user@user-MS-7817:~/xboard/xboard-4.7.2$ ./configure --enable-zippy
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking how to run the C preprocessor... gcc -E
checking for library containing strerror... none required
checking whether NLS is requested... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for shared library run path origin... done
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking for GNU gettext in libc... yes
checking whether to use NLS... yes
checking where the gettext function comes from... libc
checking for remsh... no
checking for rsh... rsh
checking for makeinfo... makeinfo
checking for nroff... nroff -man
checking for awk... /usr/bin/awk
checking for perl... /usr/bin/perl
checking for ANSI C header files... yes
checking whether time.h and sys/time.h may both be included... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking return type of signal handlers... void
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking stropts.h usability... yes
checking stropts.h presence... yes
checking for stropts.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking sys/systeminfo.h usability... no
checking sys/systeminfo.h presence... no
checking for sys/systeminfo.h... no
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for _getpty... no
checking for grantpt... yes
checking for setitimer... yes
checking for usleep... yes
checking for gettimeofday... yes
checking for random... yes
checking for gethostname... yes
checking for setlocale... yes
checking for getpseudotty in -lseq... no
checking whether compiler understands -Wall -Wno-parentheses... yes
checking for pkg-config... pkg-config
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for CAIRO... yes
checking for X... libraries , headers
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking X11/Intrinsic.h usability... yes
checking X11/Intrinsic.h presence... yes
checking for X11/Intrinsic.h... yes
checking X11/Xaw/Dialog.h usability... yes
checking X11/Xaw/Dialog.h presence... yes
checking for X11/Xaw/Dialog.h... yes
checking X11/xpm.h usability... yes
checking X11/xpm.h presence... yes
checking for X11/xpm.h... yes
checking for XpmReadFileToPixmap in -lXpm... yes
checking whether ptys or pipes should be used... pipes
checking for xdg-mime... /usr/bin/xdg-mime
checking for xdg-desktop-menu... /usr/bin/xdg-desktop-menu
checking for xdg-icon-resource... /usr/bin/xdg-icon-resource
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating cmail
config.status: creating po/Makefile.in
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
config.status: executing test-stamp-h commands
config.status: executing chmod-cmail commands

 Configurations summary:

        prefix:          /usr/local       
        datarootdir:     ${prefix}/share 
        datadir:         ${datarootdir}   (icons will go in $datadir/icons/hicolor/...)
                                    (bitmaps will go in $datadir/games/xboard/...)
        infodir:         ${datarootdir}/info   (info files will go here)
        sysconfdir:      ${prefix}/etc   (xboard.conf will go here)

        update mimedb:   yes

        NLS support:     yes

        GTK:             no
        Xaw3d:           no
        Xaw:             yes

        xpm:             yes
        ptys:            pipes
        zippy:           yes
        sigint:          yes


Now the system keeps complaining xboard: Unrecognized argument -zp. I don`t know what`s the issue this time.
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Re: Gnuchess book

Postby H.G.Muller » 02 May 2014, 11:21

Now that you have run ./configure, it will have created a new Makefile for you. And when you run make/install it will create and install a new XBoard according to the instructions in there. (Which now will include zippy in the build). You should delete all *.o files first, though, because although make is smart enough to recompile when the corresponding .c file was changed, I don't think it is smart enough to recompile when the Makefile has changed (and other compile commands might thus now be specified to generate the binaries from the source).

So:

rm *.o
make
sudo make install

This should give you the zippy-enabled XBoard as default XBoard (i.e. the one that will be fired up when you give the xboard command from the command prompts)..
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Gnuchess book

Postby matrix101 » 02 May 2014, 12:11

Ok now I did

cd xboard/xboard-4.7.2

~/xboard/xboard-4.7.2$ rm *.o

~/xboard/xboard-4.7.2$ ./configure --enable-zippy

make

sudo make install.

Now when I try

Code: Select all
xboard -fcp ./gnuchess -fd ./gnuchess/gnuchess-6.1.1/src -zp -ics freechess.org


getaddrinfo(, 5000): Name or service not known
xboard: Could not connect to host , port 5000: No such file or directory
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Next

Return to Winboard and related Topics

Who is online

Users browsing this forum: No registered users and 13 guests