using Stockfish's search as a module?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

using Stockfish's search as a module?

Post by maksimKorzh »

Hi guys
First of all thanks for helping with sf's build/clean.

After getting familiar with sf's code base ( I'm very surprised with the fact I've managed to understand the overall picture) I've clearly realized that all I need from sf is only search, preferably without threads for simplicity.

It's easier for me to write a custom movegen for Chinese chess rather then embedding it to sf's code (like in fairy stockfish) because I would need to drop 90% of code since I'm not involving bitboards and going for array based implementation I already have.

A logical question is arising at this point -
can I just reuse sf's search?

However 2 things confuses me:
1. Threads (handling them in make move in particular)
2. I don't yet realize how strongly does sf's search relies on position data structure
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: using Stockfish's search as a module?

Post by hgm »

Perhaps a good first step would be to convert Stockfish to a mailbox engine for Chess. If that works, you can deal with the change in board size.
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: using Stockfish's search as a module?

Post by maksimKorzh »

hgm wrote: Mon Mar 15, 2021 8:19 am Perhaps a good first step would be to convert Stockfish to a mailbox engine for Chess. If that works, you can deal with the change in board size.
It sounds like a reasonable idea but my main issue is the monolithic arch of sf. Just for a comparison in most of my engines one can take some part away and it would still be working. Search behaves as a module that can be copypasted and serving whatever variant. With sf it's totally different - dropping bitboards means to alter almost all of the source files and my current understanding is not enough for that. Moreover if rewriting everything but search it feels easier to write all from scratch (reusing sf's environment and design patterns)
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: using Stockfish's search as a module?

Post by maksimKorzh »

Ok, I would try to ask it in a bit different manner:
are their any engines reusing SF's search completely/partially?

And if so then how likely it was to integrate SF's search with what you had at the time?