WandererXII / lishogi

☗ lishogi.org: the forever free, adless and open source shogi server forked from lichess.org ☗
https://lishogi.org
GNU Affero General Public License v3.0
272 stars 41 forks source link

Chushogi - engine integration #627

Open WandererXII opened 1 year ago

WandererXII commented 1 year ago

HaChu

Relevant links: Source: https://salsa.debian.org/debian/hachu/-/tree/master HaChu: http://hgm.nubati.net/HaChu.html XBoard protocol: http://hgm.nubati.net/CECP.html

What we actually want to support has to be considered:

  1. Computer play
  2. Server analysis
  3. Local analysis

Definitely want to support Computer play(1), depending on how different the output for XBoard protocol is Server analysis(2). might be considered, this would also make very little sense without adding it shoginet. Local analysis (3) is probably not attainable unless someone wants to compile HaChu to wasm.

I haven't look too much into it, but these issues might arise:

  1. Rules such as lion bridge capture, lance backrank promotions, repetitions might differ
  2. Integrating XBoard protocol into our USI ecosystem

For 1. I guess there is no other way than to tweak the source. Integrating (2.) the XBoard protocol is probably not gonna be a problem, but I don't think adding it to shoginet is a good idea, having three engines seems like too much, maybe it could be optional...

Also this segfaults with HaChu, what am I doing wrong?

xboard
protover 2
new
go
AlexGTrick commented 1 year ago

Also this segfaults with HaChu, what am I doing wrong?

As far as I know, the crash of HaChu occurs in Win10. If you try Win7, it should work correctly.

At least, ChuDo doesn't work on Win10 with the same problem, because of HaChu is crashing.

WandererXII commented 1 year ago

Also this segfaults with HaChu, what am I doing wrong?

As far as I know, the crash of HaChu occurs in Win10. If you try Win7, it should work correctly.

At least, ChuDo doesn't work on Win10 with the same problem, because of HaChu is crashing.

Well, I'm on linux, it probably didn't compile right, if I'm using the protocol correctly.

ddugovic commented 1 year ago

Please, you're doing amazing work with the site... I can focus on implementing rules correctly in HaChu if I understand what to implement...

ddugovic commented 1 year ago

I got hachu running on my Ubuntu PC with make then cat 1.txt - | ./hachu :

1.txt:

xboard
protover 2
level 40 5 0
memory 64
new
variant chu
hard
post
ping 1
go
WandererXII commented 1 year ago

Please, you're doing amazing work with the site... I can focus on implementing rules correctly in HaChu if I understand what to implement...

Thanks, that would be a great help! I am not sure about all the rules differences between lishogi implementation and HaChu implementation, but some contested rules I described are here https://lishogi1.org/assets/sandbox/chushogi/rules.html. Rules should be completely? explained here: https://lishogi.org/variant/chushogi. Not sure whether it's better to add it then to shogiops or just make a separate script for chushogi?

I got hachu running on my Ubuntu PC with make then cat 1.txt - | ./hachu :

1.txt:

...

Nice! This works for me too. Thanks!

ddugovic commented 1 year ago

Not sure whether it's better to add it then to shogiops or just make a separate script for chushogi?

Good question; right now I don't know.

My current plan is to find some Lishogi BOT client to play unrated games so other players (or a second bot account) can help test. Sure, CECP/USI differences might be unstable, but writing a test suite from these rules explanations seems more challenging than trusting the Lishogi implementation.

Smooshy30 commented 1 year ago

HaChu is quite a weak engine in terms of lack of SMP and not using NNUE. But it could be implemented as a milestone on the path to developing a stronger engine.

ddugovic commented 1 year ago

HaChu source code is confusing, so if you feel like implementing something different I won't object; but for now I'll keep working with it.

AlexGTrick commented 1 year ago

Sure, CECP/USI differences might be unstable, but writing a test suite from these rules explanations seems more challenging than trusting the Lishogi implementation.

What is CESP/USI?

ddugovic commented 1 year ago

Hm... CECP is the chess engine communication protocol whereas USI is the universal shogi interface. I guess SECP would be the shogi engine communication protocol.

~Regardless... working with HaChu I'm starting to imagine that it might be easier to start with some other engine/language since I'm having so many difficult-to-trace errors, unfortunately.~