Discuss Scratch

WhiteDoveOfficial
Scratcher
38 posts

Better Scratch Chess Engines

ArnoHu wrote:

First of all, sorry for necro-posting, but there is good reason. Back in 2019 / 2020 I had not heard of Efficiently Updatable Neural Networks (NNUEs) yet, and was thinking of Chess NNs in terms as of Leela Zero.

And even once I had learned about NNUEs, amazing as they were in native engines, I doubted we could make it function on Scratch (TurboWarp yes, Scratch no).

However, instead of speculating, two weeks ago I simply tried and did it. It only took me three evenings, as I ported an existing NNUE and replaced GoK's classic evaluation function with it.

Quick note on its neural network design:

768 => ( 2 x 256 ) => 1

Featuerset (input) size is 768 (for 12 piece types x 64 squares), with 2 layers of 256 neurons each. NN has “viewpoints” for black and white. For every simple move applied or reverted, 2,048 accumulator items must updated (more on captures, promotions, castling). for evaluation, 1,024 weights and accumulator items are combined. That is still a heavy workload esp. on the Scratch runtime.

Here is GoK NNUE:
https://scratch.mit.edu/projects/1033379869

TurboWarp version:
https://turbowarp.org/1033379869

You can find more details about GoK NNUE's implementation in this forum posting:
https://scratch.mit.edu/discuss/post/8014663/

I don't know how many of you are still on Scratch, but I would be happy if you'd give a try and tell me what you think.

Thank you!

I find these forum posts quite interesting! Even just a bit ago, NNUEs were thought to be impossible (not just difficult, but impossible on Scratch), and now, there are 3 fully functional top-5 Scratch/TW engines, and with Black Crow v8.35 + Delta 5 being quite close to a release (I'm actually not totally sure about when Delta 5 will release officially), it's not out of the question that top-3 could be NNUE!
gdellar22
Scratcher
40 posts

Better Scratch Chess Engines

Someone please convert sunfish. It’s only 141 lines of code!
WhiteDoveOfficial
Scratcher
38 posts

Better Scratch Chess Engines

gdellar22 wrote:

Someone please convert sunfish. It’s only 141 lines of code!

Sounds interesting, but it likely wouldn't be stronger than the top-5 engines on Scratch anyhow.
ArnoHu
Scratcher
1000+ posts

Better Scratch Chess Engines

gdellar22 wrote:

Someone please convert sunfish. It’s only 141 lines of code!

There will be a lot more code required, due to the lack of equivalent libraries / APIs that Python has.

Powered by DjangoBB