New engine: belofte

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Gabor Szots
Posts: 1362
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: New engine: belofte

Post by Gabor Szots »

Thanks Yves.

I have successfully compiled 0.9.16 but I got warnings:
usercmd.cpp: In function 'void cmd_computer(const char*, const char*)':
usercmd.cpp:516:10: warning: 'char* strncat(char*, const char*, size_t)' specified bound 1024 equals destination size [-Wstringop-overflow=]
strncat(game.szOpponentName, " (computer)", sizeof (game.szOpponentName));
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
YUtils.cpp: In function 'void ins_char(char*, char, int)':
YUtils.cpp:62:10: warning: 'char* strncat(char*, const char*, size_t)' specified bound 1024 equals destination size [-Wstringop-overflow=]
strncat(szBuffer, szDest + i, MAX_DATANAME_LENGTH);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I don't know what they mean but I thought it could be useful to you.

And the 25 % CPU usage problem (when idle) has not gone. Also, when starting from the command line, drawing the board and initializing takes much longer than before, I can see the lines being drawn (strangely, not on every start-up).
Gabor Szots
CCRL testing group
ydebilloez
Posts: 163
Joined: Tue Jun 27, 2017 11:01 pm
Location: Lubumbashi
Full name: Yves De Billoëz

Re: New engine: belofte

Post by ydebilloez »

Dear Gabor,

Thanks for your feedback. What compiler and what platform did you compile on?
Gabor Szots wrote: Thu Mar 05, 2020 3:05 pm usercmd.cpp: In function 'void cmd_computer(const char*, const char*)':
usercmd.cpp:516:10: warning: 'char* strncat(char*, const char*, size_t)' specified bound 1024 equals destination size [-Wstringop-overflow=]
strncat(game.szOpponentName, " (computer)", sizeof (game.szOpponentName));
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I don't know what they mean but I thought it could be useful to you.
It is indeed a coding error that should be corrected. It can generate a buffer overflow or worse if the program is used with bad intentions.
The third paramter should be sizeof() - current strlen - 1 I believe to be safe.
With normal usage of the program it should not present a problem. I will try to correct in the future. I do not see any use-case in which someone would exploit this - except another chess program trying to crash belofte or to make belofte make a bad move and claim a win....-
Gabor Szots wrote: Thu Mar 05, 2020 3:05 pm And the 25 % CPU usage problem (when idle) has not gone. Also, when starting from the command line, drawing the board and initializing takes much longer than before, I can see the lines being drawn (strangely, not on every start-up).
I will look into the CPU usage.

The other issue, when an input is pending on the command line, belofte will wait 500ms before going ahead... something that was introduced to prevent the prompt to be displayed when the uci/xboard is issued shortly after starting belofte. I will finetune the behaviour to avoid it in some cases.
Yves De Billoëz @ macchess belofte chess
Once owner of a Mephisto I, II, challenger, ... chess computer.
Gabor Szots
Posts: 1362
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: New engine: belofte

Post by Gabor Szots »

ydebilloez wrote: Fri Mar 06, 2020 8:41 pm What compiler and what platform did you compile on?
I have an i5-4690K CPU running 64-bit Windows 10 and the compiler is g++ (part of MinGW-w64).
Gabor Szots
CCRL testing group
ydebilloez
Posts: 163
Joined: Tue Jun 27, 2017 11:01 pm
Location: Lubumbashi
Full name: Yves De Billoëz

Re: New engine: belofte

Post by ydebilloez »

Belofte 0.9.18 released. This is mainly a bugfix release that solves regressions introduced by 0.9.14 and 0.9.16.
Also fixes CPU usage. Timeobserver thread on linux using 5% and windows 25% (time function?) only starts when time bound search is starting.
Due to commenting some parts in the unused second engine,windows executable size has been reduced from 500k to 190k.

Fixes:

* Remove result when undoing move.
* Remove compile warnings introduced in 0.9.16 (regression)
* Correct regression on some testcases introduced on 0.9.16.
* CPU usage when idle, fixed depth search and perft test lowered.

Enhancements:

* When passing parameter on command line, do not wait for 500 ms on
first command. With initialisation script, uci/xboard should be passed
in the initialisation script now.
* Allow epd id tag surrounded by quotes.
* Add pgn command. Set start FEN position in PGN file. Fill in round in
pgn tag roster. Set event to autosave or name of engine.
* eval command returns information on game-end position.
* Belofte can now be launched with command and parameter on command line
e.g. ./belofte epd matein1.epd

Some compile warnings on GCC 8 remain because of size parameter in strncat being to generous.
Yves De Billoëz @ macchess belofte chess
Once owner of a Mephisto I, II, challenger, ... chess computer.
Gabor Szots
Posts: 1362
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: New engine: belofte

Post by Gabor Szots »

Dear Yves,

Thanks for your efforts but I have bad news.

When I try to play a game against Belofte, it starts thinking when out of book but it never moves. In fact I can see with task manager that after a couple of moves it is no longer in memory.

Here is an Arena debug:
2020-03-08 11:13:17,898-->1:?
2020-03-08 11:13:17,898-->1:force
2020-03-08 11:13:17,898-->1:quit
2020-03-08 11:13:18,288*1*--------------------Starting engine 1 Belofte 0.9.18 WB---------------------
2020-03-08 11:13:18,288*1*Configured Engine 1 Type: WB2
2020-03-08 11:13:18,288*1*Engine 1 dir: E:\Sakk\Engines\Belofte
2020-03-08 11:13:18,288*1*Engine 1 commandline: E:\Sakk\Engines\Belofte\Belofte_0.9.18.exe
2020-03-08 11:13:18,398*1*Child Process Prio Adj: PID 10564 conhost.exe
2020-03-08 11:13:18,398*1*Engine 1 ProcessID: 2256
2020-03-08 11:13:18,398*1*Engine 1 Prio:32 ThreadPrio:0
2020-03-08 11:13:18,398-->1:xboard
2020-03-08 11:13:18,398-->1:protover 2
2020-03-08 11:13:18,460<--1:This is 'Belofte 0.9.18' (A Promising Chess Program)
2020-03-08 11:13:18,460<--1:Copyright (C) 1981-2020 Yves De Billoëz
2020-03-08 11:13:18,460<--1:Please refer to the license terms (license.html) before using.
2020-03-08 11:13:18,523<--1:Type 'help' for a list of commands.
2020-03-08 11:13:18,523<--1:Type 'protover 4' to have more modern interface.
2020-03-08 11:13:18,523<--1: FEN: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
2020-03-08 11:13:18,523<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:18,523<--1:| r | n | b | q | k | b | n | r |
2020-03-08 11:13:18,523<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:18,554<--1:| p | p | p | p | p | p | p | p |
2020-03-08 11:13:18,585<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:18,616<--1:| | | | | | | | |
2020-03-08 11:13:18,616<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:18,648<--1:| | | | | | | | |
2020-03-08 11:13:18,679<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:18,710<--1:| | | | | | | | |
2020-03-08 11:13:18,741<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:18,773<--1:| | | | | | | | |
2020-03-08 11:13:18,773<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:18,804<--1:| P | P | P | P | P | P | P | P |
2020-03-08 11:13:18,804<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:18,835<--1:| R | N | B | Q | K | B | N | R |
2020-03-08 11:13:18,866<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:18,866<--1:Belofte>
2020-03-08 11:13:18,866<--1:feature done=0
2020-03-08 11:13:18,866-->1:accepted done
2020-03-08 11:13:18,866<--1:feature ping=1 setboard=1 playother=1 san=0 usermove=1 time=1
2020-03-08 11:13:18,866-->1:accepted ping
2020-03-08 11:13:18,866-->1:accepted setboard
2020-03-08 11:13:18,866-->1:accepted playother
2020-03-08 11:13:18,866-->1:accepted san
2020-03-08 11:13:18,866-->1:accepted usermove
2020-03-08 11:13:18,866-->1:accepted time
2020-03-08 11:13:18,866<--1:feature draw=0 sigint=1 sigterm=1 reuse=0 debug=1
2020-03-08 11:13:18,866-->1:accepted draw
2020-03-08 11:13:18,866-->1:accepted sigint
2020-03-08 11:13:18,866-->1:accepted sigterm
2020-03-08 11:13:18,866-->1:accepted reuse
2020-03-08 11:13:18,866-->1:accepted debug
2020-03-08 11:13:18,866<--1:feature ics=0
2020-03-08 11:13:18,866-->1:accepted ics
2020-03-08 11:13:18,866<--1:feature name=1 pause=0 analyze=0 colors=0 nps=0
2020-03-08 11:13:18,866-->1:accepted name
2020-03-08 11:13:18,866-->1:accepted pause
2020-03-08 11:13:18,866-->1:accepted analyze
2020-03-08 11:13:18,866-->1:accepted colors
2020-03-08 11:13:18,866-->1:accepted nps
2020-03-08 11:13:18,866<--1:feature myname="Belofte 0.9.18"
2020-03-08 11:13:18,866<--1:feature variants="normal"
2020-03-08 11:13:18,866-->1:accepted variants
2020-03-08 11:13:18,882<--1:feature done=1
2020-03-08 11:13:18,882-->1:accepted done
2020-03-08 11:13:18,882*1*Child Process Prio Adj: PID 10564 conhost.exe
2020-03-08 11:13:19,007-->1:new
2020-03-08 11:13:19,007-->1:random
2020-03-08 11:13:19,007-->1:level 0 2 1
2020-03-08 11:13:19,007-->1:post
2020-03-08 11:13:19,007-->1:hard
2020-03-08 11:13:19,007-->1:easy
2020-03-08 11:13:19,007-->1:ping 2
2020-03-08 11:13:19,023<--1:pong 2
2020-03-08 11:13:19,038-->1:name Belofte 0.9.18 64-bit
2020-03-08 11:13:24,976-->1:?
2020-03-08 11:13:24,976-->1:force
2020-03-08 11:13:24,976-->1:quit
2020-03-08 11:13:25,351*1*--------------------Starting engine 1 Belofte 0.9.18 WB---------------------
2020-03-08 11:13:25,351*1*Configured Engine 1 Type: WB2
2020-03-08 11:13:25,351*1*Engine 1 dir: E:\Sakk\Engines\Belofte
2020-03-08 11:13:25,351*1*Engine 1 commandline: E:\Sakk\Engines\Belofte\Belofte_0.9.18.exe
2020-03-08 11:13:25,460*1*Child Process Prio Adj: PID 732 conhost.exe
2020-03-08 11:13:25,476*1*Engine 1 ProcessID: 10544
2020-03-08 11:13:25,476*1*Engine 1 Prio:32 ThreadPrio:0
2020-03-08 11:13:25,476-->1:xboard
2020-03-08 11:13:25,476-->1:protover 2
2020-03-08 11:13:25,538<--1:This is 'Belofte 0.9.18' (A Promising Chess Program)
2020-03-08 11:13:25,538<--1:Copyright (C) 1981-2020 Yves De Billoëz
2020-03-08 11:13:25,585<--1:Please refer to the license terms (license.html) before using.
2020-03-08 11:13:25,585<--1:Type 'help' for a list of commands.
2020-03-08 11:13:25,585<--1:Type 'protover 4' to have more modern interface.
2020-03-08 11:13:25,585<--1: FEN: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
2020-03-08 11:13:25,616<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:25,616<--1:| r | n | b | q | k | b | n | r |
2020-03-08 11:13:25,648<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:25,648<--1:| p | p | p | p | p | p | p | p |
2020-03-08 11:13:25,679<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:25,679<--1:| | | | | | | | |
2020-03-08 11:13:25,710<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:25,741<--1:| | | | | | | | |
2020-03-08 11:13:25,773<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:25,804<--1:| | | | | | | | |
2020-03-08 11:13:25,835<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:25,866<--1:| | | | | | | | |
2020-03-08 11:13:25,866<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:25,898<--1:| P | P | P | P | P | P | P | P |
2020-03-08 11:13:25,898<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:25,929<--1:| R | N | B | Q | K | B | N | R |
2020-03-08 11:13:25,929<--1:+---+---+---+---+---+---+---+---+
2020-03-08 11:13:25,929<--1:Belofte>
2020-03-08 11:13:25,960<--1:feature done=0
2020-03-08 11:13:25,960-->1:accepted done
2020-03-08 11:13:25,960<--1:feature ping=1 setboard=1 playother=1 san=0 usermove=1 time=1
2020-03-08 11:13:25,960-->1:accepted ping
2020-03-08 11:13:25,960-->1:accepted setboard
2020-03-08 11:13:25,960-->1:accepted playother
2020-03-08 11:13:25,960-->1:accepted san
2020-03-08 11:13:25,960-->1:accepted usermove
2020-03-08 11:13:25,960-->1:accepted time
2020-03-08 11:13:25,991<--1:feature draw=0 sigint=1 sigterm=1 reuse=0 debug=1
2020-03-08 11:13:25,991-->1:accepted draw
2020-03-08 11:13:25,991-->1:accepted sigint
2020-03-08 11:13:25,991-->1:accepted sigterm
2020-03-08 11:13:25,991-->1:accepted reuse
2020-03-08 11:13:25,991-->1:accepted debug
2020-03-08 11:13:26,023<--1:feature ics=0
2020-03-08 11:13:26,023-->1:accepted ics
2020-03-08 11:13:26,054<--1:feature name=1 pause=0 analyze=0 colors=0 nps=0
2020-03-08 11:13:26,054-->1:accepted name
2020-03-08 11:13:26,054-->1:accepted pause
2020-03-08 11:13:26,054-->1:accepted analyze
2020-03-08 11:13:26,054-->1:accepted colors
2020-03-08 11:13:26,054-->1:accepted nps
2020-03-08 11:13:26,085<--1:feature myname="Belofte 0.9.18"
2020-03-08 11:13:26,116<--1:feature variants="normal"
2020-03-08 11:13:26,116-->1:accepted variants
2020-03-08 11:13:26,148<--1:feature done=1
2020-03-08 11:13:26,148-->1:accepted done
2020-03-08 11:13:26,148*1*Child Process Prio Adj: PID 732 conhost.exe
2020-03-08 11:13:26,210-->1:new
2020-03-08 11:13:26,210-->1:random
2020-03-08 11:13:26,210-->1:level 0 2 1
2020-03-08 11:13:26,210-->1:post
2020-03-08 11:13:26,210-->1:hard
2020-03-08 11:13:26,210-->1:easy
2020-03-08 11:13:26,210-->1:ping 1
2020-03-08 11:13:26,226<--1:pong 1
2020-03-08 11:13:26,241-->1:name Belofte 0.9.18 WB
2020-03-08 11:13:26,804**----------New game---2020-03-08 11:13:26,804 V -------------
2020-03-08 11:13:26,804-->1:level 0 2 1
2020-03-08 11:13:26,804-->1:new
2020-03-08 11:13:26,804-->1:random
2020-03-08 11:13:26,804-->1:level 0 2 1
2020-03-08 11:13:26,804-->1:post
2020-03-08 11:13:26,804-->1:hard
2020-03-08 11:13:26,804-->1:easy
2020-03-08 11:13:26,804-->1:ping 2
2020-03-08 11:13:26,820<--1:pong 2
2020-03-08 11:13:26,835-->1:name Belofte 0.9.18 WB
2020-03-08 11:13:26,835**Loading book: E:\Sakk\Arena2\Books\SideLines.abk
2020-03-08 11:13:30,944*1*Start calc, move no: 1
2020-03-08 11:13:30,944*1*Main Book Move SideLines.abk: d7d6
2020-03-08 11:13:31,835*1*Start calc, move no: 3
2020-03-08 11:13:31,898-->1:level 0 2 1
2020-03-08 11:13:31,898-->1:new
2020-03-08 11:13:31,898-->1:random
2020-03-08 11:13:31,898-->1:level 0 2 1
2020-03-08 11:13:31,898-->1:post
2020-03-08 11:13:31,898-->1:hard
2020-03-08 11:13:31,898-->1:easy
2020-03-08 11:13:31,898-->1:ping 7
2020-03-08 11:13:31,913<--1:pong 7
2020-03-08 11:13:31,929-->1:name Gabor Szots
2020-03-08 11:13:31,929-->1:force
2020-03-08 11:13:32,148-->1:usermove e2e4
2020-03-08 11:13:32,148-->1:usermove d7d6
2020-03-08 11:13:32,148-->1:usermove e4e5
2020-03-08 11:13:32,163-->1:ping 10
2020-03-08 11:13:32,163<--1:pong 10
2020-03-08 11:13:32,179-->1:ping 16
2020-03-08 11:13:32,194<--1:pong 16
2020-03-08 11:13:32,210-->1:time 12100
2020-03-08 11:13:32,210-->1:otim 12158
2020-03-08 11:13:32,210-->1:go
2020-03-08 11:13:32,210<--1: got time 12100 (for game)
2020-03-08 11:13:32,210<--1: got otim 12158
2020-03-08 11:13:32,210<--1: Starting search for black, rnbqkbnr/ppp1pppp/3p4/4P3/8/8/PPPP1PPP/RNBQKBNR b KQkq - 0 2
2020-03-08 11:13:32,210<--1: Time left for game (KO) 2:43, for move 3 (max 5), Ficher increment 1
2020-03-08 11:13:32,210<--1: 1+ 57 0 1 d6e5
2020-03-08 11:13:32,210<--1: 1. 57 0 27 d6e5
2020-03-08 11:13:32,210<--1: 2- 21 0 87 d6e5
2020-03-08 11:13:32,210<--1: 2- 22 0 300 b8c6
2020-03-08 11:13:32,210<--1: 2. 22 0 339 b8c6
2020-03-08 11:13:32,241<--1: 3+ 58 0 1081 d6e5
2020-03-08 11:13:32,257<--1: 3: 58 0 1907 d6e5
2020-03-08 11:13:32,444<--1: 4- 45 0 8984 d6e5
2020-03-08 11:13:32,585<--1: 4. 45 0 14365 d6e5
2020-03-08 11:15:35,090-->1:?
2020-03-08 11:16:44,012-->1:?
Gabor Szots
CCRL testing group
ydebilloez
Posts: 163
Joined: Tue Jun 27, 2017 11:01 pm
Location: Lubumbashi
Full name: Yves De Billoëz

Re: New engine: belofte

Post by ydebilloez »

Gabor Szots wrote: Sun Mar 08, 2020 11:22 am Thanks for your efforts but I have bad news.

When I try to play a game against Belofte, it starts thinking when out of book but it never moves. In fact I can see with task manager that after a couple of moves it is no longer in memory.
I have seen 2 different problems:
1) On windows 32 bit, the version 0.9.18 seems to crash. 0.9.16 seems fine.
2) The version 0.9.18 requires you to pass -xboard as a parameter on startup. You can configure this in the parameter section of Arena.

The Windows version does not wait long enough to see the xboard command issued directly after launching Belofte. Belofte continues its initialisation and Arena does expect an answer to the xboard and protover 2 command that only arrives after arena has finished interpreting the startup-strings and thus both Arena and Belofte remain unsynchronised. If you pass the -xboard parameter, belofte will not print anything on startup and things go fine.

I do not have a windows debugger anymore but can reproduce the crash. I hope to resolve it. Will keep you updated when the issue goes away. In my opinion, the fact that i removed some C++ code, DevC++ does not link anymore all libraries and the program crashes on a missing library. With another compiler, the issue could go away (I hope).

Regards,
Yves
Yves De Billoëz @ macchess belofte chess
Once owner of a Mephisto I, II, challenger, ... chess computer.
Gabor Szots
Posts: 1362
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: New engine: belofte

Post by Gabor Szots »

ydebilloez wrote: Fri Mar 13, 2020 1:08 pm I have seen 2 different problems:
1) On windows 32 bit, the version 0.9.18 seems to crash. 0.9.16 seems fine.
2) The version 0.9.18 requires you to pass -xboard as a parameter on startup. You can configure this in the parameter section of Arena.

The Windows version does not wait long enough to see the xboard command issued directly after launching Belofte. Belofte continues its initialisation and Arena does expect an answer to the xboard and protover 2 command that only arrives after arena has finished interpreting the startup-strings and thus both Arena and Belofte remain unsynchronised. If you pass the -xboard parameter, belofte will not print anything on startup and things go fine.
Unfortunately not. It does not move even if I give -xboard on the command line.
Gabor Szots
CCRL testing group
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: New engine: belofte

Post by Roland Chastain »

Hello Yves!

I wanted to test Belofte 2 on my Linux PC. Unfortunately there is a problem of missing library.

Code: Select all

[roland@localhost belofte]$ ./belofte64-2.0.2
./belofte64-2.0.2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ./belofte64-2.0.2)
Same for v2.0.4 and v2.0.6.

Now I will see if I can compile it.

Regards.

Roland
Qui trop embrasse mal étreint.
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: New engine: belofte

Post by Roland Chastain »

I could compile Belofte (using your script project/compile.sh). Now it works.
Qui trop embrasse mal étreint.
fncll
Posts: 2
Joined: Thu Nov 14, 2019 6:47 pm
Full name: Chris Lott

Re: New engine: belofte

Post by fncll »

Any tips on compiling on OSX (10.15.7)? I get the following error:

Code: Select all

ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
At the beginning of the compile I get these warnings:

Code: Select all

ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libc++.tbd, missing required architecture i386 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libc++.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
TIA!