Discuss Scratch

S_P_A_R_T
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

This did not age so well (my 2020 forum prediction if Chess neural networks would be possible on Scratch). https://scratch.mit.edu/discuss/post/3734295/

*NNUE is possible*

Everyone: Wait, this is an actually viable way to do evaluation on Scratch?

GoK NNUE: Always has been

Check out Space Program Simulator!





In it, you can build your own rockets from a variety of parts!
Then fly it with realistic orbital mechanics.

Go to orbit, explore different planets, share your save codes, and do so much more!

If you would like to help out on the project or chat about space or really anything else, check out the offical SPS Studio!

For more information & tutorials, check out the offical forum post!

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

Congrats White Dove to this 94% to 89% win against GoK NNUE, both at 10sec think time: https://lichess.org/I2IsAaO0#116

I cannot say NNUE played bad (just too risky giving away material), WD just played better.

Last edited by ArnoHu (June 15, 2024 12:28:05)

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

S_P_A_R_T wrote:

ArnoHu wrote:

This did not age so well (my 2020 forum prediction if Chess neural networks would be possible on Scratch). https://scratch.mit.edu/discuss/post/3734295/

*NNUE is possible*

Everyone: Wait, this is an actually viable way to do evaluation on Scratch?

GoK NNUE: Always has been

Haha, yes. Well in all fairness, back then NNUE had not been shipped in chess engines, the first Stockfish implementation came in 2020. We talked about something like Leela Zero, not NNUE.

Last edited by ArnoHu (June 15, 2024 12:27:16)

ababoin07
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

ababoin07 wrote:

Sorry, but Destructor NNUE is broken AND my pc no longer works, so I won’t be able to repair Destructor

Sorry to hear, but will you get your PC repaired or a new one?
I think it’s the graphics card that dropped (a long beep, three short), I will test the graphics card on another pc to see if it works, if not, I would buy an new rtx 3060
ababoin07
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

I arranged with my little brother, he lends me his laptop, so I repaired Destructor NNUE ( chess neural network )!
HasiLover_Test
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

ababoin07 wrote:

I arranged with my little brother, he lends me his laptop, so I repaired Destructor NNUE ( chess neural network )!
Thanks alot
ababoin07
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

HasiLover_Test wrote:

ababoin07 wrote:

I arranged with my little brother, he lends me his laptop, so I repaired Destructor NNUE ( chess neural network )!
Thanks alot
yes
ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

ababoin07 wrote:

HasiLover_Test wrote:

ababoin07 wrote:

I arranged with my little brother, he lends me his laptop, so I repaired Destructor NNUE ( chess neural network )!
Thanks alot
yes

Congrats, you were fast to make it work!

1st test game, GoK NNUE (Medium, white) vs Destructor NNUE, GoK wins in 23 moves: https://lichess.org/Qv0UdiWg#45
HasiLover_Test
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

ababoin07 wrote:

HasiLover_Test wrote:

ababoin07 wrote:

I arranged with my little brother, he lends me his laptop, so I repaired Destructor NNUE ( chess neural network )!
Thanks alot
yes
Scurious 3 was also able to beat it, with 94% accuracy. At 5 Ply depth https://lichess.org/WPIMJd4O#50, it seems to be making alot of bad moves, you should train it a bit more I think, once your PC works again.

Last edited by HasiLover_Test (June 15, 2024 13:36:42)

ababoin07
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

HasiLover_Test wrote:

ababoin07 wrote:

HasiLover_Test wrote:

ababoin07 wrote:

I arranged with my little brother, he lends me his laptop, so I repaired Destructor NNUE ( chess neural network )!
Thanks alot
yes
Scurious 3 was also able to beat it, with 94% accuracy. At 5 Ply depth https://lichess.org/WPIMJd4O#50, it seems to be making alot of bad moves, you should train it a bit more I think, once your PC works again.
effectively
ababoin07
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

ababoin07 wrote:

HasiLover_Test wrote:

ababoin07 wrote:

HasiLover_Test wrote:

ababoin07 wrote:

I arranged with my little brother, he lends me his laptop, so I repaired Destructor NNUE ( chess neural network )!
Thanks alot
yes
Scurious 3 was also able to beat it, with 94% accuracy. At 5 Ply depth https://lichess.org/WPIMJd4O#50, it seems to be making alot of bad moves, you should train it a bit more I think, once your PC works again.
effectively
I've deleted the quiescence search…
ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

Finished the GoK NNUE (white) vs. Bonsai Blue game on Scratch 3 with recent GoK S3 endgame fix: https://lichess.org/aEiOgTSg#149

First win for GoK NNUE against Bonsai, 2 : 2 overall.

Getting NNUE right on S3 is one of the real challenges. 92% accuracy looks a lot better already. I disabled quiescence extensions and other performance-heavy features, so that GoK NNUE can reach a certain minimum search depth.

Last edited by ArnoHu (June 15, 2024 15:23:30)

-089-
Scratcher
14 posts

Scratch Chess Engine - Game of Kings

ababoin07 wrote:

ababoin07 wrote:

HasiLover_Test wrote:

ababoin07 wrote:

HasiLover_Test wrote:

ababoin07 wrote:

I arranged with my little brother, he lends me his laptop, so I repaired Destructor NNUE ( chess neural network )!
Thanks alot
yes
Scurious 3 was also able to beat it, with 94% accuracy. At 5 Ply depth https://lichess.org/WPIMJd4O#50, it seems to be making alot of bad moves, you should train it a bit more I think, once your PC works again.
effectively
I've deleted the quiescence search…
https://lichess.org/KC4DCF5x#36 test game vs shallow blue, destructor NNUE is black. it's opening play is interesting, ignoring the center but taking a bunch of space on kingside and queenside instead.
18… Qxd4?? surprised me a lot, I can't tell if that's a search depth problem or not
ababoin07
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

-089- wrote:

ababoin07 wrote:

ababoin07 wrote:

HasiLover_Test wrote:

ababoin07 wrote:

HasiLover_Test wrote:

ababoin07 wrote:

I arranged with my little brother, he lends me his laptop, so I repaired Destructor NNUE ( chess neural network )!
Thanks alot
yes
Scurious 3 was also able to beat it, with 94% accuracy. At 5 Ply depth https://lichess.org/WPIMJd4O#50, it seems to be making alot of bad moves, you should train it a bit more I think, once your PC works again.
effectively
I've deleted the quiescence search…
https://lichess.org/KC4DCF5x#36 test game vs shallow blue, destructor NNUE is black. it's opening play is interesting, ignoring the center but taking a bunch of space on kingside and queenside instead.
18… Qxd4?? surprised me a lot, I can't tell if that's a search depth problem or not
I think it's a problem of depth, yes
AZURUS41
Scratcher
55 posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

Congrats to Element (black) for this game against GoK NNUE. It clearly would / should have won, but ran into a final-second threefold-repetition.

GoK detected it as a draw and stopped playing, Element wanted to continue. What is a bit strange is that lichess / Stockfish on import detects the draw on the move before, but reverts after the final move? It is a draw from all I can tell. https://lichess.org/J7hLv03T#133

GoK saw it was doomed for a long time, but nothing it could do. Worth mentioning, I had to re-import into Element once (an Undo button would be really great!), but that was far before the three-fold came into reach.

BTW, Element ran into Page-Unresponsive timeouts more or less all through midgame (next time it must play against GoK Difficult :-) ). I know it does not have iterative deepening, but couldn't it just do a quick 5+8 run, cache results, then run 6+8, and in case of timeout, re-use the 5+8 result?
Yes Lichess always does that ( reverting it after the draw )
ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

AZURUS41 wrote:

ArnoHu wrote:

Congrats to Element (black) for this game against GoK NNUE. It clearly would / should have won, but ran into a final-second threefold-repetition.

GoK detected it as a draw and stopped playing, Element wanted to continue. What is a bit strange is that lichess / Stockfish on import detects the draw on the move before, but reverts after the final move? It is a draw from all I can tell. https://lichess.org/J7hLv03T#133

GoK saw it was doomed for a long time, but nothing it could do. Worth mentioning, I had to re-import into Element once (an Undo button would be really great!), but that was far before the three-fold came into reach.

BTW, Element ran into Page-Unresponsive timeouts more or less all through midgame (next time it must play against GoK Difficult :-) ). I know it does not have iterative deepening, but couldn't it just do a quick 5+8 run, cache results, then run 6+8, and in case of timeout, re-use the 5+8 result?
Yes Lichess always does that ( reverting it after the draw )

OK, thank you, that explains it!
birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

AZURUS41 wrote:

ArnoHu wrote:

Congrats to Element (black) for this game against GoK NNUE. It clearly would / should have won, but ran into a final-second threefold-repetition.

GoK detected it as a draw and stopped playing, Element wanted to continue. What is a bit strange is that lichess / Stockfish on import detects the draw on the move before, but reverts after the final move? It is a draw from all I can tell. https://lichess.org/J7hLv03T#133

GoK saw it was doomed for a long time, but nothing it could do. Worth mentioning, I had to re-import into Element once (an Undo button would be really great!), but that was far before the three-fold came into reach.

BTW, Element ran into Page-Unresponsive timeouts more or less all through midgame (next time it must play against GoK Difficult :-) ). I know it does not have iterative deepening, but couldn't it just do a quick 5+8 run, cache results, then run 6+8, and in case of timeout, re-use the 5+8 result?
Yes Lichess always does that ( reverting it after the draw )

OK, thank you, that explains it!
What happens here is simple; lichess marks the position before the threefold as 0.0 because the losing side can make a move to cause a threefold. This occurs if the losing side makes the final move. If the winning side makes the final move, the final move will be marked as 0.0 because the winning side was winning prior to the game ending.

Just for clarification, Element detects twofolds for itself, but only in the root node. Here, it never actually twofolds with a move that it made itself.

Element really needs the extra ply obtained from 6+8. If the 4+8 IID search takes too long to run, it doesn’t run 6+8 at all and it runs 5+8 instead. Timeouts are expected on 6+8. 3 or more timeouts are not expected with this change in v1.488. Your device is so fast, the failsafe never kick in!

In my opinion, running 5+8 is not worth it. The speed loss is too much. However, I can lower the amount it takes the failsafe to kick in. If I do that, Element may struggle to reach 6+8 on lower end devices. Realistically, the most likely solution is either LMR/NMP or better move ordering where PSTs fail (history moves).
ababoin07
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

I have a question, for the move ordering, you evaluated the positions to what depth? Otherwise I will be afk for two weeks… Destructor with iterative deepening will come out in about 1 month
birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

ababoin07 wrote:

I have a question, for the move ordering, you evaluated the positions to what depth? Otherwise I will be afk for two weeks… Destructor with iterative deepening will come out in about 1 month
I do not know what you mean, but Element uses MVV-LVA and piece-square tables for its move ordering. Originally, I made the move and then used the evaluation function, but that’s not the best method (although it is still faster than no move ordering).
ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

Improved NNUE performance for Scratch runtime by 50% (knowing Scratch runtime inner workings helps, because not all those optimizations are intuitive), and it showed immediately in a first game against Bonsai Blue, GoK NNUE (Difficult, white) at 92% accuracy, much better then the previous games we saw:
https://lichess.org/V2pZJC5y#55

BTW, performance tor TurboWarp stayed as it was (I am glad it did not degrade). That's the world of Scratch runtimes. Scratch 3 create a new Stack at runtime for every structure block it enters, who knows why…

And about that one blunder, for 24 out of 25 seconds NN had produced the right move (Be6), just to give it up at the last moment for Bf4, which it deemed slightly better. Otherwise would have been a perfect game.

We are getting closer to the goal to make NNUE play well on Scratch, too.

Last edited by ArnoHu (June 15, 2024 20:59:16)

Powered by DjangoBB