New engine: Stash

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

Moderators: hgm, Rebel, chrisw

mhouppin
Posts: 115
Joined: Wed Feb 12, 2020 5:00 pm
Full name: Morgan Houppin

New engine: Stash

Post by mhouppin »

Hi there!

I have been working recently on a chess engine as a hobby, and I'm finally happy to release it after 4 months of (occasional) work ! It isn't based or derived from another engine, and should play at around 1450 Elo. It is written in C, and UCI-compliant.

Link: https://gitlab.com/mhouppin/stash-bot

Any feedback would be really appreciated !
bctboi23
Posts: 20
Joined: Fri Feb 07, 2020 2:48 am
Location: United States
Full name: Tom R

Re: New engine: Stash

Post by bctboi23 »

Hey! I'm just getting into this stuff too, and it gets to be a fun little side project

as for improvements to the engine, I just took a look at your search, and would recommend adding a form of null move pruning. It really helps with reaching higher depths, and can give a ton of elo. Also, I just recently had a lot of success with a tapered evaluation (added 100 selfplay elo to my engine with the tapered eval + some better PSQT) so that could be something to take a look at.

Overall, it's super fun to figure out improvements, and a lot of people here are super helpful in that type of stuff!
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: New engine: Stash

Post by Roland Chastain »

Hello! Congratulations.

I could compile it without any problem under Linux. The code looks very clean and well organized. The engine is nor too weak neither too strong. Exactly the kind of program that I like. :)
Qui trop embrasse mal étreint.
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: New engine: Stash

Post by Guenther »

Roland Chastain wrote: Sat Feb 15, 2020 8:23 am Hello! Congratulations.

I could compile it without any problem under Linux. The code looks very clean and well organized. The engine is nor too weak neither too strong. Exactly the kind of program that I like. :)
I had tons of conversion type warnings with gcc for a windows compile.
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
mhouppin
Posts: 115
Joined: Wed Feb 12, 2020 5:00 pm
Full name: Morgan Houppin

Re: New engine: Stash

Post by mhouppin »

Guenther wrote: Sat Feb 15, 2020 9:12 am
Roland Chastain wrote: Sat Feb 15, 2020 8:23 am Hello! Congratulations.

I could compile it without any problem under Linux. The code looks very clean and well organized. The engine is nor too weak neither too strong. Exactly the kind of program that I like. :)
I had tons of conversion type warnings with gcc for a windows compile.
Fixed now ^^ I forgot that Windows was having some weird format strings for size types ("%I64u" instead of "%zu")

Also thank you for your help bctboi, I am currently testing Null Move Search and it seems to really improve the performances of my engine :)
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: New engine: Stash

Post by Guenther »

mhouppin wrote: Sat Feb 15, 2020 10:28 am
Guenther wrote: Sat Feb 15, 2020 9:12 am
Roland Chastain wrote: Sat Feb 15, 2020 8:23 am Hello! Congratulations.

I could compile it without any problem under Linux. The code looks very clean and well organized. The engine is nor too weak neither too strong. Exactly the kind of program that I like. :)
I had tons of conversion type warnings with gcc for a windows compile.
Fixed now ^^ I forgot that Windows was having some weird format strings for size types ("%I64u" instead of "%zu")

Also thank you for your help bctboi, I am currently testing Null Move Search and it seems to really improve the performances of my engine :)
Yeah that really looked funny (before it crashed) ;-)
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: New engine: Stash

Post by Guenther »

mhouppin wrote: Sat Feb 15, 2020 10:28 am
Guenther wrote: Sat Feb 15, 2020 9:12 am
I had tons of conversion type warnings with gcc for a windows compile.
Fixed now ^^ I forgot that Windows was having some weird format strings for size types ("%I64u" instead of "%zu")

Also thank you for your help bctboi, I am currently testing Null Move Search and it seems to really improve the performances of my engine :)
Thanks all well now as expected.
I will add Stash to my chronology of available XB/UCI programs soon.
I am I right that you are French? (for the nationality of the entry in the chronology)

Congrats for your first release.

Code: Select all

uci
id name Stash v8.0
id author Morgan Houppin (@mhouppin)
option name Threads type spin default 1 min 1 max 32
option name Hash type spin default 16 min 1 max 4096
option name Clear Hash type button
option name Minimum Thinking Time type spin default 20 min 0 max 30000
option name Move Overhead type spin default 20 min 0 max 1000
uciok
ucinewgame
position startpos
go
info depth 1 nodes 22 nps 0 time 0 score cp 55 pv e2e4
info depth 2 nodes 145 nps 0 time 0 score cp 27 pv e2e4
info depth 3 nodes 1967 nps 196700 time 10 score cp 27 pv g1f3
info depth 4 nodes 14944 nps 747200 time 20 score cp 20 pv g1f3
info depth 4 nodes 49152 nps 1638400 time 30 score cp 20 pv g1f3
bestmove g1f3
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
mhouppin
Posts: 115
Joined: Wed Feb 12, 2020 5:00 pm
Full name: Morgan Houppin

Re: New engine: Stash

Post by mhouppin »

Guenther wrote: Sat Feb 15, 2020 10:50 am
mhouppin wrote: Sat Feb 15, 2020 10:28 am
Guenther wrote: Sat Feb 15, 2020 9:12 am
I had tons of conversion type warnings with gcc for a windows compile.
Fixed now ^^ I forgot that Windows was having some weird format strings for size types ("%I64u" instead of "%zu")

Also thank you for your help bctboi, I am currently testing Null Move Search and it seems to really improve the performances of my engine :)
Thanks all well now as expected.
I will add Stash to my chronology of available XB/UCI programs soon.
I am I right that you are French? (for the nationality of the entry in the chronology)

Congrats for your first release.

Code: Select all

uci
id name Stash v8.0
id author Morgan Houppin (@mhouppin)
option name Threads type spin default 1 min 1 max 32
option name Hash type spin default 16 min 1 max 4096
option name Clear Hash type button
option name Minimum Thinking Time type spin default 20 min 0 max 30000
option name Move Overhead type spin default 20 min 0 max 1000
uciok
ucinewgame
position startpos
go
info depth 1 nodes 22 nps 0 time 0 score cp 55 pv e2e4
info depth 2 nodes 145 nps 0 time 0 score cp 27 pv e2e4
info depth 3 nodes 1967 nps 196700 time 10 score cp 27 pv g1f3
info depth 4 nodes 14944 nps 747200 time 20 score cp 20 pv g1f3
info depth 4 nodes 49152 nps 1638400 time 30 score cp 20 pv g1f3
bestmove g1f3
Yup, French developer ^^
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: New engine: Stash

Post by Guenther »

Morgan, I noticed that Stash uses one cpu also in ponder off games, when it is not its turn?
Maybe another windows glitch. Some kind of polling?

BTW I wonder why you have the threads option enabled - is this release really smp? (haven't checked the code)
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: New engine: Stash

Post by mvanthoor »

Congratulations on your first release :)

I am thrilled to read that you are starting from scratch without using another engine as a reference. It's a lot of work, but that way, you can establish a baseline ELO, and see the strength gains your engine makes with each new function you implement. (In the beginning, those gains will be positively huge; possibly >100 ELO for implementing a search optimization or an extra evaluation parameter. Search Madchess.net for more info. Erik Madsen chronicled the development of Madchess 2 and 3 after establishing the baseline.)

I've looked at your code. Congratulations about that as well. It's one of the most readable implementations I've seen in a long time. It avoids the pitfall of having lots of if/switch/for/while blocks wrapped into one-another. If you remove the numbers that appear throughout (replace them by constants) and add a lot of comments, this could be a great reference engine.

It compiles cleanly under Windows (MSYS2 / MinGW64). A suggestion: change the build script so it compiles statically. Now you need to have libwinpthread-1.dll in the same folder as stash-bot.exe. This is just a matter of taste obviously, but in the case of chess engines, my preference is to have a single executable that works without any dependencies.

===

As an aside: Some months ago, I _finally_ started writing my own chess engine, using the Rust programming language. (My one constraint with regard to writing a chess engine is to NOT use C or C++, because everybody and their dog has a C/C++ chess engine. C/C++ are fast, but they're also ancient with lots of pitfalls.)

Your engine seems to use board iteration to find the pieces, and then iterates over the squares in each direction the piece can move. My engine is using magic bitboards, and I've just reached the stage where I start to implement the move generator. (I reserve the engine name to for myself, because I haven't decided yet :p)

I can't wait to finish by engine to a playable baseline and then pit it against this version of Stash, because they're both original, not derived from any other engines, in the beginning stages of development, they use different programming languages, and different board representations.

Good luck to you :)

(Some output of the partially complete move generator of my engine...)

Code: Select all

    Finished dev [unoptimized + debuginfo] target(s) in 0.54s
     Running `target\debug\xyz.exe`

Engine: xyz
Author: mvanthoor

8   . . . r . . . .
7   . . b k . . . .
6   . . . I N . . .
5   . . . . . . . i
4   . i I . . n . .
3   . . . i . . . I
2   N n . . . . . .
1   K R . B . . . .

    A B C D E F G H

Kd7d6 (capture)
Kd7e6 (capture)
Kd7c6 (normal)
Kd7e7 (normal)
Kd7c8 (normal)
Kd7e8 (normal)
Nb2d1 (capture)
Nb2c4 (capture)
Nb2a4 (normal)
Nf4h3 (capture)
Nf4e6 (capture)
Nf4e2 (normal)
Nf4g2 (normal)
Nf4d5 (normal)
Nf4g6 (normal)
Done.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL