New UCI Engine: Demolito

Discussion about chess-playing software (engines, hosts, opening books, platforms, etc...)
lucasart
Posts: 201
Joined: Mon Dec 17, 2012 1:09 pm
Contact:

New UCI Engine: Demolito

Post by lucasart » Sat Jan 14, 2017 1:45 pm

Written from scratch, although many pieces were taken (or adapted) from DiscoCheck:
https://github.com/lucasart/demolito
By computer standards, it's rather weak (roughly on par with Sungorus 1.4 = 2300 elo CCRL 40/4). But that should be enough if you want to play against it (unless you're a GM).

Known issues:
  • Chess960 works, but only if the GUI uses Shredder FEN (ie. AHah, not KQkq).
  • SMP works (ie. does what it's designed to do), but doesn't scale. So it's best not to use it for now.
  • Relies on thread local storage, whose Windows implementation sucks. So it's going to be slow on Windows, and fast on Linux, Android, and (possibly) MacOSX.
I'm not providing any compile, because, at this stage, I'm more interested in feedback from programmers than casual users.
"Talk is cheap. Show me the code." -- Linus Torvalds.

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: New UCI Engine: Demolito

Post by BB+ » Mon Jan 16, 2017 3:39 am

lucasart wrote:Written from scratch, although many pieces were taken (or adapted) from DiscoCheck:
...
I'm not providing any compile, because, at this stage, I'm more interested in feedback from programmers than casual users.
Given your frequent comments about C++, is there any reason why you chose it rather than plain C?

lucasart
Posts: 201
Joined: Mon Dec 17, 2012 1:09 pm
Contact:

Re: New UCI Engine: Demolito

Post by lucasart » Tue Jan 31, 2017 10:22 am

Demolito is now on par with Fruit 05/11/03, rated 2792 elo on CCRL 40/4.

So, almost 500 elo in 2 code patches, the first of which is a >200 elo ridiculous bug fix :lol:
"Talk is cheap. Show me the code." -- Linus Torvalds.

lucasart
Posts: 201
Joined: Mon Dec 17, 2012 1:09 pm
Contact:

Re: New UCI Engine: Demolito

Post by lucasart » Fri Mar 24, 2017 11:52 pm

Fixed SMP crashes.

Scaling looks very good:

Code: Select all

8 threads vs 1 thread: 686 - 93 - 421  [0.747] 1200
ELO difference: 188.16 +/- 16.55
This is actually on a i7 machine with 4 physical cores, using 8 HT cores. Should be significantly better on a real 8 core machine.
"Talk is cheap. Show me the code." -- Linus Torvalds.

User923005
Posts: 616
Joined: Thu May 19, 2011 1:35 am

Re: New UCI Engine: Demolito

Post by User923005 » Sat Mar 25, 2017 1:02 am

I have indirection errors when I compile:

Code: Select all

$ gcc *.cc
In file included from types.h:5:0,
                 from bitboard.h:2,
                 from move.h:2,
                 from move.cc:16:
move.cc: In member function 'Move::operator move_t() const':
move.cc:28:20: error: invalid user-defined conversion from 'const Move' to 'const Move*' [-fpermissive]
     assert(move_ok(*this));
                    ^~
move.cc:26:1: note: candidate is: Move::operator move_t() const <near match>
 Move::operator move_t() const
 ^~~~
move.cc:26:1: note:   no known conversion from 'move_t {aka short unsigned int}' to 'const Move*'
move.cc:20:6: note:   initializing argument 1 of 'bool move_ok(const Move*)'
 bool move_ok(const Move *m)
      ^~~~~~~
In file included from types.h:5:0,
                 from bitboard.h:2,
                 from move.h:2,
                 from move.cc:16:
move.cc: In member function 'Move Move::operator=(move_t)':
move.cc:37:20: error: invalid user-defined conversion from 'Move' to 'const Move*' [-fpermissive]
     assert(move_ok(*this));
                    ^~
move.cc:26:1: note: candidate is: Move::operator move_t() const <near match>
 Move::operator move_t() const
 ^~~~
move.cc:26:1: note:   no known conversion from 'move_t {aka short unsigned int}' to 'const Move*'
move.cc:20:6: note:   initializing argument 1 of 'bool move_ok(const Move*)'
 bool move_ok(const Move *m)
      ^~~~~~~

User923005
Posts: 616
Joined: Thu May 19, 2011 1:35 am

Re: New UCI Engine: Demolito

Post by User923005 » Sat Mar 25, 2017 1:11 am

By removing the indirection operators on the this pointer in the asserts, I got it to compile and link just fine.

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ g++ -O3 -march=native -DNDEBUG -std=c++11 -lpthread *.cc

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ strip a.exe

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ mv a.exe demolito.exe

But I get a segfault after uci followed by ucinewgame:

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ ./demolito.exe
uci
id name Demolito
id author lucasart
option name UCI_Chess960 type check default false
option name Hash type spin default 1 min 1 max 1048576
option name Threads type spin default 1 min 1 max 64
option name Contempt type spin default 10 min -100 max 100
option name Time Buffer type spin default 30 min 0 max 1000
uciok
ucinewgame
Segmentation fault

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src

lucasart
Posts: 201
Joined: Mon Dec 17, 2012 1:09 pm
Contact:

Re: New UCI Engine: Demolito

Post by lucasart » Sat Mar 25, 2017 5:16 am

User923005 wrote:I have indirection errors when I compile:

Code: Select all

$ gcc *.cc
In file included from types.h:5:0,
                 from bitboard.h:2,
                 from move.h:2,
                 from move.cc:16:
move.cc: In member function 'Move::operator move_t() const':
move.cc:28:20: error: invalid user-defined conversion from 'const Move' to 'const Move*' [-fpermissive]
     assert(move_ok(*this));
                    ^~
move.cc:26:1: note: candidate is: Move::operator move_t() const <near match>
 Move::operator move_t() const
 ^~~~
move.cc:26:1: note:   no known conversion from 'move_t {aka short unsigned int}' to 'const Move*'
move.cc:20:6: note:   initializing argument 1 of 'bool move_ok(const Move*)'
 bool move_ok(const Move *m)
      ^~~~~~~
In file included from types.h:5:0,
                 from bitboard.h:2,
                 from move.h:2,
                 from move.cc:16:
move.cc: In member function 'Move Move::operator=(move_t)':
move.cc:37:20: error: invalid user-defined conversion from 'Move' to 'const Move*' [-fpermissive]
     assert(move_ok(*this));
                    ^~
move.cc:26:1: note: candidate is: Move::operator move_t() const <near match>
 Move::operator move_t() const
 ^~~~
move.cc:26:1: note:   no known conversion from 'move_t {aka short unsigned int}' to 'const Move*'
move.cc:20:6: note:   initializing argument 1 of 'bool move_ok(const Move*)'
 bool move_ok(const Move *m)
      ^~~~~~~
You're not compiling correctly. Please have a look at the make.sh file.
"Talk is cheap. Show me the code." -- Linus Torvalds.

lucasart
Posts: 201
Joined: Mon Dec 17, 2012 1:09 pm
Contact:

Re: New UCI Engine: Demolito

Post by lucasart » Sat Mar 25, 2017 5:17 am

User923005 wrote:By removing the indirection operators on the this pointer in the asserts, I got it to compile and link just fine.

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ g++ -O3 -march=native -DNDEBUG -std=c++11 -lpthread *.cc

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ strip a.exe

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ mv a.exe demolito.exe

But I get a segfault after uci followed by ucinewgame:

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ ./demolito.exe
uci
id name Demolito
id author lucasart
option name UCI_Chess960 type check default false
option name Hash type spin default 1 min 1 max 1048576
option name Threads type spin default 1 min 1 max 64
option name Contempt type spin default 10 min -100 max 100
option name Time Buffer type spin default 30 min 0 max 1000
uciok
ucinewgame
Segmentation fault

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
You forgot isready after uci. Please have a look at the UCI protocol.
"Talk is cheap. Show me the code." -- Linus Torvalds.

User923005
Posts: 616
Joined: Thu May 19, 2011 1:35 am

Re: New UCI Engine: Demolito

Post by User923005 » Tue Mar 28, 2017 7:12 pm

lucasart wrote:
User923005 wrote:I have indirection errors when I compile:

Code: Select all

$ gcc *.cc
In file included from types.h:5:0,
                 from bitboard.h:2,
                 from move.h:2,
                 from move.cc:16:
move.cc: In member function 'Move::operator move_t() const':
move.cc:28:20: error: invalid user-defined conversion from 'const Move' to 'const Move*' [-fpermissive]
     assert(move_ok(*this));
                    ^~
move.cc:26:1: note: candidate is: Move::operator move_t() const <near match>
 Move::operator move_t() const
 ^~~~
move.cc:26:1: note:   no known conversion from 'move_t {aka short unsigned int}' to 'const Move*'
move.cc:20:6: note:   initializing argument 1 of 'bool move_ok(const Move*)'
 bool move_ok(const Move *m)
      ^~~~~~~
In file included from types.h:5:0,
                 from bitboard.h:2,
                 from move.h:2,
                 from move.cc:16:
move.cc: In member function 'Move Move::operator=(move_t)':
move.cc:37:20: error: invalid user-defined conversion from 'Move' to 'const Move*' [-fpermissive]
     assert(move_ok(*this));
                    ^~
move.cc:26:1: note: candidate is: Move::operator move_t() const <near match>
 Move::operator move_t() const
 ^~~~
move.cc:26:1: note:   no known conversion from 'move_t {aka short unsigned int}' to 'const Move*'
move.cc:20:6: note:   initializing argument 1 of 'bool move_ok(const Move*)'
 bool move_ok(const Move *m)
      ^~~~~~~
You're not compiling correctly. Please have a look at the make.sh file.
If your compile in debug mode, you should get the same problems.
move_ok wants a pointer, not an object.

User923005
Posts: 616
Joined: Thu May 19, 2011 1:35 am

Re: New UCI Engine: Demolito

Post by User923005 » Tue Mar 28, 2017 7:13 pm

lucasart wrote:
User923005 wrote:By removing the indirection operators on the this pointer in the asserts, I got it to compile and link just fine.

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ g++ -O3 -march=native -DNDEBUG -std=c++11 -lpthread *.cc

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ strip a.exe

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ mv a.exe demolito.exe

But I get a segfault after uci followed by ucinewgame:

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
$ ./demolito.exe
uci
id name Demolito
id author lucasart
option name UCI_Chess960 type check default false
option name Hash type spin default 1 min 1 max 1048576
option name Threads type spin default 1 min 1 max 64
option name Contempt type spin default 10 min -100 max 100
option name Time Buffer type spin default 30 min 0 max 1000
uciok
ucinewgame
Segmentation fault

DCorbit@dcorbit MINGW64 /f/project/dcorbit/Demolito-master/src
You forgot isready after uci. Please have a look at the UCI protocol.
Quite right.
I have been doing it wrong for years.
Your engine is the only one that ever crashed from my wrong sequence.

Post Reply