Discuss Scratch

WhiteDoveOfficial
Scratcher
38 posts

Scratch Chess Engine - Game of Kings

birdracerthree wrote:

ArnoHu wrote:

birdracerthree wrote:

ArnoHu wrote:

Today I published “Connect 4”, which uses similar components as Game of Kings Chess. You can find it here:



Feedback is very welcome!
We also have its rival, https://scratch.mit.edu/projects/1109505895/

Please tell me how to fix my UI. Thanks!

Excellent playing strength! If one could click the target columns that would help. Simply have stage mouse click handler, and use mouse coordinates.
Oh, thanks, I… forgot the stage clicked button existed…
Lol
WhiteDoveOfficial
Scratcher
38 posts

Scratch Chess Engine - Game of Kings

[Black "White Dove v8.00"] [White "Player"] 1. h2h3 e7e5 2. e2e4 d7d5 3. e4d5 Ng8f6 4. Nb1c3 Nf6d5 5. Nc3d5 Qd8d5 6. Ng1e2 Nb8c6 7. Ne2c3 Qd5a5 8. Bf1c4 Bf8c5 9. O-O Nc6d4 10. d2d3 O-O 11. Bc1e3 Bc8f5 12. a2a3 Bc5e7 13. b2b4 Qa5b6 14. Nc3d5 Qb6d6 15. Nd5e7 Qd6e7 16. Be3d4 e5d4 17. Rf1e1 Qe7f6 18. Qd1f3 Ra8b8 19. Re1e2 b7b6 20. Ra1e1 Qf6g6 21. Re2e7 c7c5 22. Re7a7 c5b4 23. a3b4 Bf5e6 24. Bc4e6 f7e6 25. Qf3c6 Rb8c8 26. Qc6e6 Qg6e6 27. Re1e6 Rc8c2 28. Re6b6 Rf8f2 29. Rb6b8 Rf2f8 30. Rb8b7 Rf8f2 31. Rb7g7 Kg8f8 32. Rg7g3 h7h5 33. Rg3f3 Rf2f3 34. g2f3 Rc2c3 35. Ra7h7 Rc3d3 36. Rh7h5 Rd3f3 37. Kg1g2 Rf3b3 38. b4b5 Kf8e7 39. Rh5d5 d4d3 40. Kg2f2 Ke7e6 41. Rd5d4 Ke6e5 42. Rd4d7 Ke5e4 43. Kf2e1 Rb3b5 44. Rd7e7 Ke4d4 45. Re7d7 Kd4e3 46. Rd7e7 Ke3f4 47. Ke1d2 Rb5b3 48. Re7d7 Kf4e4 49. Rd7e7 Ke4d4 50. Re7d7 Kd4c4 51. h3h4 Rb3b2 52. Kd2e3 Rb2e2 53. Ke3f3 Re2e1 54. Rd7c7 Kc4b3 55. Rc7b7 Kb3c3 56. Rb7c7 Kc3d2 57. h4h5 Re1h1 58. Rc7c5 Kd2d1 59. Rc5a5 Kd1c2 60. Ra5a2 Kc2b3 61. Ra2a8 Rh1h5 62. Kf3e3 Rh5h3 63. Ke3d2 Kb3c4 64. Ra8c8 Kc4d4 65. Rc8d8 Kd4c4 66. Rd8c8 Kc4d4 67. Rc8d8 Kd4c4 68. Rd8c8 Kc4d4 69. Rc8d8 Kd4c4 70. Rd8c8 Kc4d4 71. Rc8d8 Kd4c4

Posting a P1 test game on a slow machine…

(I was playing white; looks like there’s still some weird positional mistakes that need some fixing.)

Last edited by WhiteDoveOfficial (Dec. 28, 2024 23:11:34)

thingbaijam
New Scratcher
4 posts

Scratch Chess Engine - Game of Kings

ababoin07 wrote:

thingbaijam wrote:

I forgot to show this engine https://scratch.mit.edu/projects/884448179/
Thx, but this engine is referenced (or another version of this engine ^^)
sorry but it is a copy of a layout of chess prototype and is made by ElapElap as well
(also as a side note LA chess and GoK NNUE are copies {although very different from} GoK classical and Chess A.I)
ababoin07
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

chosebaijam wrote:

ababoin07 wrote:

thingbaijam wrote:

I forgot to show this engine https://scratch.mit.edu/projects/884448179/
Thx, but this engine is referenced (or another version of this engine ^^)
sorry but it is a copy of a layout of chess prototype and is made by ElapElap as well
(also as a side note LA chess and GoK NNUE are copies {although very different from} GoK classical and Chess A.I)
GoK and GoK NNUE are by the same author, and LA break literally Chess AI…
ElapElap
Scratcher
25 posts

Scratch Chess Engine - Game of Kings

Happy New Year!!!
ababoin07
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

ElapElap wrote:

Happy New Year!!!
You too!
Halt_JK
Scratcher
1 post

Scratch Chess Engine - Game of Kings

Happy new year!
ababoin07
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

Halt_JK wrote:

Happy new year!
Thanks, you too!
RENZOYGRECIA
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

HAPPY NEW YEAR!!!
S_P_A_R_T_Test
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

Happy new year everyone!
birdracerthree
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

OK, I need to get LMR and NMP working. After the reduced search for NMP, which beta values do I use to check for a cutoff? For example, it starts at depth 5, NMP is run on depth 2, then the code exists back to depth 5. Do I check the depth 2 alpha/beta item?
ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

birdracerthree wrote:

OK, I need to get LMR and NMP working. After the reduced search for NMP, which beta values do I use to check for a cutoff? For example, it starts at depth 5, NMP is run on depth 2, then the code exists back to depth 5. Do I check the depth 2 alpha/beta item?

You use the current beta as null-window at reduced depth (different formulas exist to calculate that depth), and if that search fails high on beta, you can prune.
ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

Connect 4 bots can be found in this studio: https://scratch.mit.edu/studios/36106829
birdracerthree
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

https://lichess.org/study/gMtEUuT4/UdTr7J8n
More GoK Classic

Last edited by birdracerthree (Jan. 2, 2025 18:03:26)

birdracerthree
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

I will say to expect some solid updates this month for Element
S_P_A_R_T_Test
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

birdracerthree wrote:

I will say to expect some solid updates this month for Element

Nice!
birdracerthree
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

Quick question : How are GoK’s attack tables so fast? I am considering that, but the speed loss would be devastating.

https://lichess.org/study/gMtEUuT4/f4MBRyHS
More GoK Classic games, here we go!

Last edited by birdracerthree (Jan. 4, 2025 18:13:30)

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

birdracerthree wrote:

Quick question : How are GoK’s attack tables so fast? I am considering that, but the speed loss would be devastating.

https://lichess.org/study/gMtEUuT4/f4MBRyHS
More GoK Classic games, here we go!

Hi, depends what you mean by fast. Last time I checked, attack table calculation used up ca. 9% of GoK runtime (incl. TT storage). It is invoked before every full search move generation (when hash move did not lead to early cutoff), and in addition always when in check (incl. q-search).

It basically uses the same move generation framework (just allowing to “attack” own pieces as well), and also creates check attack line data. But it does not apply the same the “innermost” block of move generation, and that is why it is fast.

Attack tables still pay off because they help for move ordering, allow staged move generator to run faster, to create legal king moves, and when in check to only generate legal countermoves. I once deactivated attack tables for leaf node move generation, and things turned out to be slower overall.

Here is the innermost attack table generation code block:
https://github.com/ArnoHue/scratch/blob/34b8234802f51f63d35f5696c4e9f2ce56a566e3/chess/EngineNNUE.scratch#L528

That is nothing compared to what is otherwise invoked for move generation, namely rest of AddMoveImpl(), plus GetMoveScore():
https://github.com/ArnoHue/scratch/blob/34b8234802f51f63d35f5696c4e9f2ce56a566e3/chess/EngineNNUE.scratch#L3357

Last edited by ArnoHu (Jan. 4, 2025 20:38:25)

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

An updated GoK Classic version played this series of test games on TurboWarp:

GoK Classic (Medium, black) vs. White Dove (P2), 95% vs. 92%:
https://lichess.org/study/gMtEUuT4/f4MBRyHS#168

GoK Classic (Medium, white) vs. White Dove NNUE (15s), 95% vs. 88%:
https://lichess.org/IhPFpkIz#97

GoK Classic (Medium, white) vs Delta (15s), 96% vs. 87%:
https://lichess.org/study/gMtEUuT4/UwMmwop8#89

GoK Classic (Medium, white) vs. Verde (15s), 94% vs. 84%:
https://lichess.org/CEWqDT9M#65

GoK Classic (Medium, black) vs. Element (7+8), 94% vs. 81%:
https://lichess.org/study/gMtEUuT4/1rSGAiHF#70

GoK Classic (Medium, black) vs. Shallow Blue, 96% vs. 91%:
https://lichess.org/Us9eOVww#106

GoK Classic (Medium, black) vs. LA Chess (15s), 98% vs. 89%:
https://lichess.org/4I7TSrIU#84

GoK's average accuracy was 95.5%, with 1.85 inaccuracies and 0.15 mistakes per game.

Game against GoK NNUE is next.

Last edited by ArnoHu (Jan. 5, 2025 07:25:25)

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

An updated GoK Classic version played this series of test games on TurboWarp:

GoK Classic (Medium, black) vs. White Dove (P2), 95% vs. 92%:
https://lichess.org/study/gMtEUuT4/f4MBRyHS#168

GoK Classic (Medium, white) vs. White Dove NNUE (15s), 95% vs. 88%:
https://lichess.org/IhPFpkIz#97

GoK Classic (Medium, white) vs Delta (15s), 96% vs. 87%:
https://lichess.org/study/gMtEUuT4/UwMmwop8#89

GoK Classic (Medium, white) vs. Verde (15s), 94% vs. 84%:
https://lichess.org/CEWqDT9M#65

GoK Classic (Medium, black) vs. Element (7+8), 94% vs. 81%:
https://lichess.org/study/gMtEUuT4/1rSGAiHF#70

GoK Classic (Medium, black) vs. Shallow Blue, 96% vs. 91%:
https://lichess.org/Us9eOVww#106

GoK Classic (Medium, black) vs. LA Chess (15s), 98% vs. 89%:
https://lichess.org/4I7TSrIU#84

GoK's average accuracy was 95.5%, with 1.85 inaccuracies and 0.15 mistakes per game.

Game against GoK NNUE is next.

GoK NNUE (Medium, white) vs. GoK Classic, 99% vs. 95%:
https://lichess.org/aebZrUR2#131

Powered by DjangoBB