Page 1 of 2

New UCI Engine: Demolito

PostPosted: Sat Jan 14, 2017 1:45 pm
by lucasart
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.

Re: New UCI Engine: Demolito

PostPosted: Mon Jan 16, 2017 3:39 am
by BB+
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?

Re: New UCI Engine: Demolito

PostPosted: Tue Jan 31, 2017 10:22 am
by lucasart
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:

Re: New UCI Engine: Demolito

PostPosted: Fri Mar 24, 2017 11:52 pm
by lucasart
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.

Re: New UCI Engine: Demolito

PostPosted: Sat Mar 25, 2017 1:02 am
by User923005
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)
      ^~~~~~~

Re: New UCI Engine: Demolito

PostPosted: Sat Mar 25, 2017 1:11 am
by User923005
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

Re: New UCI Engine: Demolito

PostPosted: Sat Mar 25, 2017 5:16 am
by lucasart
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.

Re: New UCI Engine: Demolito

PostPosted: Sat Mar 25, 2017 5:17 am
by lucasart
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.

Re: New UCI Engine: Demolito

PostPosted: Tue Mar 28, 2017 7:12 pm
by User923005
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.

Re: New UCI Engine: Demolito

PostPosted: Tue Mar 28, 2017 7:13 pm
by User923005
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.