Discuss Scratch
- Discussion Forums
- » Show and Tell
- » Scratch Chess Engine - Game of Kings
- internet44
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
found out that the pawn structure code in shallow blue didn't work properly, I had left some custom block operators blank by accident. with that fixed, here is an updated 5s game against Wolverine 2, if you'll remember this was a draw previously: https://lichess.org/cIkURCzA
- Destructor_chess
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
sb broke tk v2 lol https://lichess.org/aGIehRGR#0
- ArnoHu
-
Scratcher
1000+ posts
Scratch Chess Engine - Game of Kings
The next GoK NNUE version (currently on dev stage at https://turbowarp.org/1033379869) looks pretty strong, 97% vs. 88% against Black Crow:
https://lichess.org/study/4JLzgBmK/JujDSpV7
GoK's only inaccuracy was not detected by BC.
Looks like the super aggressive net is both a blessing and a curse lol. I might have to add a slight HCE term for S3, to try to add a penalty for being down material, as I cannot trust BC on S3 to actually successfully complete king attacks, where's it's basically just half-blind
GoK NNUE vs. Black Crow, 98% vs. 91%:
https://lichess.org/study/4JLzgBmK/bqo1tE7G
GoK Classic vs. Shallow Blue 3, 90% vs. 86%:
https://lichess.org/study/4JLzgBmK/YFKxvXqJ
- waabooboo
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
Are pawn storm/shield middlegame bonuses applied at the start of the game, or only after castling?
The implementations I looked at seem to apply these values from move 1. But I tried this in Wolverine, and it harmed his quality of play. With the pawn shield bonuses, Wolverine plays on the flanks, not castling or moving the central pawns. Not sure if my implementation is correct
The implementations I looked at seem to apply these values from move 1. But I tried this in Wolverine, and it harmed his quality of play. With the pawn shield bonuses, Wolverine plays on the flanks, not castling or moving the central pawns. Not sure if my implementation is correct

- coooolboy55
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
I made my check detection faster for my Connect 4 AI. Currently, it doesn't help its play much (except on scratch), but it will help me add more to it (like bias for the random games), to make it better. The other times I added bias to the random move generator, it made the AI worse for some reason. I suspect it was because it slowed the AI down, resulting in less accurate results.
- grkw2020
-
Scratcher
500+ posts
Scratch Chess Engine - Game of Kings
I made my check detection faster for my Connect 4 AI. Currently, it doesn't help its play much (except on scratch), but it will help me add more to it (like bias for the random games), to make it better. The other times I added bias to the random move generator, it made the AI worse for some reason. I suspect it was because it slowed the AI down, resulting in less accurate results.Is the updated one in the project? Because that win detection can still be sped up a LOT.
- coooolboy55
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
Yes.I made my check detection faster for my Connect 4 AI. Currently, it doesn't help its play much (except on scratch), but it will help me add more to it (like bias for the random games), to make it better. The other times I added bias to the random move generator, it made the AI worse for some reason. I suspect it was because it slowed the AI down, resulting in less accurate results.Is the updated one in the project? Because that win detection can still be sped up a LOT.
- grkw2020
-
Scratcher
500+ posts
Scratch Chess Engine - Game of Kings
If you want to make it even faster, start from where the last piece was inserted. All possible rows of four will contain that piece.Yes.I made my check detection faster for my Connect 4 AI. Currently, it doesn't help its play much (except on scratch), but it will help me add more to it (like bias for the random games), to make it better. The other times I added bias to the random move generator, it made the AI worse for some reason. I suspect it was because it slowed the AI down, resulting in less accurate results.Is the updated one in the project? Because that win detection can still be sped up a LOT.
- coooolboy55
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
That is almost exactly what I am doing.If you want to make it even faster, start from where the last piece was inserted. All possible rows of four will contain that piece.Yes.I made my check detection faster for my Connect 4 AI. Currently, it doesn't help its play much (except on scratch), but it will help me add more to it (like bias for the random games), to make it better. The other times I added bias to the random move generator, it made the AI worse for some reason. I suspect it was because it slowed the AI down, resulting in less accurate results.Is the updated one in the project? Because that win detection can still be sped up a LOT.
- grkw2020
-
Scratcher
500+ posts
Scratch Chess Engine - Game of Kings
Really? Huh, it looks quite different to my implementation.That is almost exactly what I am doing.If you want to make it even faster, start from where the last piece was inserted. All possible rows of four will contain that piece.Yes.I made my check detection faster for my Connect 4 AI. Currently, it doesn't help its play much (except on scratch), but it will help me add more to it (like bias for the random games), to make it better. The other times I added bias to the random move generator, it made the AI worse for some reason. I suspect it was because it slowed the AI down, resulting in less accurate results.Is the updated one in the project? Because that win detection can still be sped up a LOT.
- Destructor_chess
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
You can also search in 2 directions at same time, or with look-up tables…That is almost exactly what I am doing.If you want to make it even faster, start from where the last piece was inserted. All possible rows of four will contain that piece.Yes.I made my check detection faster for my Connect 4 AI. Currently, it doesn't help its play much (except on scratch), but it will help me add more to it (like bias for the random games), to make it better. The other times I added bias to the random move generator, it made the AI worse for some reason. I suspect it was because it slowed the AI down, resulting in less accurate results.Is the updated one in the project? Because that win detection can still be sped up a LOT.
- grkw2020
-
Scratcher
500+ posts
Scratch Chess Engine - Game of Kings
Wait, you're still here? Also what do you mean by looking in two directions at the same time. And wouldn't look up tables not really help without bitwise operators?You can also search in 2 directions at same time, or with look-up tables…That is almost exactly what I am doing.If you want to make it even faster, start from where the last piece was inserted. All possible rows of four will contain that piece.Yes.I made my check detection faster for my Connect 4 AI. Currently, it doesn't help its play much (except on scratch), but it will help me add more to it (like bias for the random games), to make it better. The other times I added bias to the random move generator, it made the AI worse for some reason. I suspect it was because it slowed the AI down, resulting in less accurate results.Is the updated one in the project? Because that win detection can still be sped up a LOT.
Last edited by grkw2020 (Sept. 16, 2025 08:04:33)
- coooolboy55
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
I gave my bot the capability of playing Connect 4 at high speeds. I switched from the scratch timer to the “days since 2000” block (which is more accurate). It's quite funny that my bot can beat/tie some Connect 4 bots at the speed of 0.1 seconds.
- grkw2020
-
Scratcher
500+ posts
Scratch Chess Engine - Game of Kings
I gave my bot the capability of playing Connect 4 at high speeds. I switched from the scratch timer to the “days since 2000” block (which is more accurate). It's quite funny that my bot can beat/tie some Connect 4 bots at the speed of 0.1 seconds.Impressive!
- Destructor_chess
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
I gave my bot the capability of playing Connect 4 at high speeds. I switched from the scratch timer to the “days since 2000” block (which is more accurate). It's quite funny that my bot can beat/tie some Connect 4 bots at the speed of 0.1 seconds.How much knps?
- WhiteDoveOfficial
-
Scratcher
38 posts
Scratch Chess Engine - Game of Kings
I gave my bot the capability of playing Connect 4 at high speeds. I switched from the scratch timer to the “days since 2000” block (which is more accurate). It's quite funny that my bot can beat/tie some Connect 4 bots at the speed of 0.1 seconds.
Nice!
(BTW, have you tried a few games vs GoC or EosZero?)
- coooolboy55
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
My Connect 4 AI, at normal computing time, cannot beat the best Connect 4 engines, also at normal computing time. I tried to put GoC on 0.1 computing time (by changing the code), but for some reason, the computing time wasn't very accurate. I was able to find out how to put computing time on EosZero though. Here is a game of EosZero vs Connect4AI (mine) at 0.1 seconds per move, with mine starting: 434444374333377711111177666666222222555555I gave my bot the capability of playing Connect 4 at high speeds. I switched from the scratch timer to the “days since 2000” block (which is more accurate). It's quite funny that my bot can beat/tie some Connect 4 bots at the speed of 0.1 seconds.
Nice!
(BTW, have you tried a few games vs GoC or EosZero?)
Suprisingly it drew against my AI.
EosZero vs Connect4AI at 0.1 seconds per move, with yours starting: 455255544442222777711237745111133
A win against my AI.
- S_P_A_R_T_Test
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
My Connect 4 AI, at normal computing time, cannot beat the best Connect 4 engines, also at normal computing time. I tried to put GoC on 0.1 computing time (by changing the code), but for some reason, the computing time wasn't very accurate. I was able to find out how to put computing time on EosZero though. Here is a game of EosZero vs Connect4AI (mine) at 0.1 seconds per move, with mine starting: 434444374333377711111177666666222222555555I gave my bot the capability of playing Connect 4 at high speeds. I switched from the scratch timer to the “days since 2000” block (which is more accurate). It's quite funny that my bot can beat/tie some Connect 4 bots at the speed of 0.1 seconds.
Nice!
(BTW, have you tried a few games vs GoC or EosZero?)
Suprisingly it drew against my AI.
EosZero vs Connect4AI at 0.1 seconds per move, with yours starting: 455255544442222777711237745111133
A win against my AI.
Thanks for the games!
Technically, Connect 4 is a theoretical win for starting player, so a draw is still quite a good result for going second

- coooolboy55
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
I updated my Connect 4 AI with move bias. It actually stands a chance against GoC.
- coooolboy55
-
Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
I updated my Connect 4 AI with move bias. It actually stands a chance against GoC.Now compute time actually matters since the move bias, while making it better, also affects the amount of games played to accurately determine the best move.








