Discuss Scratch

S_P_A_R_T
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

S_P_A_R_T wrote:

ArnoHu wrote:

I think the 2nd fastest win of GoK (Medium) on Scratch 3 against Bonsai Blue, in 12 moves. GoK saw the mate-in-3 in 0.1 seconds: https://lichess.org/ZbCw8a8b#24

Wait… If that was the 2nd fastest win, how fast was the #1?

I think there was one, but most likely I won't be able to find it any more… maybe I am also wrong.

Ah ok, do you remember the move count?

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!

birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

S_P_A_R_T wrote:

Here's a really strange WD v7.02 self play test.

This was to mainly ensure that the new table-based move gen for the pawns worked (along with some other new stuff), but this game it just terrible!

The queen get's trapped twice (and neither time does the other side realise this) and after this, the rook vs rook ending was just terrible! I stopped this game short even though black was winning because it didn't look like progress was going to occur, and even if a decisive result happened, it wouldn't really be that “important”.

https://lichess.org/jN4nYBid#107
The queen trap needs a depth of 8 to find (14. e5! Qf4 15. Ne2 Qg4 16. h3 Qh5 17. Nf4 or Ng3 plus black’s next move makes 8 moves plus quiescence.

I replayed WD’s rook endgame blunders on Element :
44. Kg2?? , Element plays 44. Ke3 (Element reaches depth 7, the depth 6 move Ra6 is also acceptable).
44… g5?? , Element plays Kd6 (reaches depth 7, depth 6 move is Ke6??)
47. Ra6?? , Element plays Kf3?? Reaches depth 7)

I don’t recommend terminating games too often, especially in late endgames. For example, https://lichess.org/study/I02Nwcbd/Pdo2EVrU#329 (ignoring 50 move rule here)

White Dove 7.01 vs Element v1.4862 - Draw in 81 moves. Around the move 48… h5, Element was showing -2 and WD -3 (black is winning). I’m surprised Element picked this up. The B+2P v R exchange didn’t help WD either.

The stalemate situation is similar to Element’s 5+8 match against Bonsai in the SCF Cup (Element only has stalemate detection in the root nodes).
ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

Earlier today I uploaded a GoK version which calculates attack tables before EVERY full search move generator run (OK not every run, as attack tables are cached in transposition table), something I had disabled years ago due to performance reasons. But GoK is faster today, and this approach allows its staged move generator to find all MVV/LVA captures with specialized code taking only a fraction of time; in addition, move ordering is better, hence pruning / LMR is better, king ring attacks will always be up-to-date for evaluation. Overall search performance stayed the same, but search quality has improved.

As a side-effect, average MPS on TurboWarp fell from 250,000 to 200,000, and NPS from 200,000 to 150,000 (although we are reaching the same search depth as before). Attack tables are created based on generated moves though, so just for fun I temporarily added attacks to MPS statistics - and it went up to 750,000 MPS.

Last edited by ArnoHu (March 30, 2024 20:30:22)

S_P_A_R_T
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

White Dove v7.03 has been released!

White Dove v7.03 is slightly faster than v7.02 as I've sped up the pawn & knight move gen with pre-made tables. I've also improved the evaluation during late endgames!

Overall, this should make WD a bit stronger in most cases, and a lot stronger in others!

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!

S_P_A_R_T
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

S_P_A_R_T wrote:

White Dove v7.03 has been released!

White Dove v7.03 is slightly faster than v7.02 as I've sped up the pawn & knight move gen with pre-made tables. I've also improved the evaluation during late endgames!

Overall, this should make WD a bit stronger in most cases, and a lot stronger in others!

v7.04 has just been released!

After a really fast update, WD v7.04 adds a “deep search mode” which is very similar to GoK's “competition mode”! (Think time = 60 sec)

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!

birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

I’ve had enough stalling… I’m switching to list-contains in the evaluation and removing mate evaluations entirely unless a mate is found. Then, the TTable is toggled off and mate evals are turned on (or I gradually reduce the depth with the TTable List-Contains). Element desperately needs LMR to keeps up with White Dove’s tactical vision. Thoughts?

Last edited by birdracerthree (March 31, 2024 05:23:15)

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

As we have new WD and GoK versions, and I was struggling to reduce dynamic evaluations (=bad for caching) when balancing net positive capture sequences vs temporary positional loss, I let GoK Medium play a quick test game against WD (P4), and GoK (white) dominated that one:

https://lichess.org/hT3iqCY7#67 (GoK wins in 34 moves, 95% vs. 85% accuracy)

GoK's one inaccuracy was due to a 8 centipawn evaluation fuzzyness, does not always happen, result of a performance-related evaluation extrapolation (staged move generator cannot provide mobility updates on early stages).

WD's blunder was a bit surprising, I thought it should have seen the effect within its horizon. Also did not let me play the en-passant, I had to re-import board.

I hope GoK's accuracy is stable in general, I had like 10 test cases where material gain must be balanced against positional loss and vice versa, the typical bishop/knight vs. king shelter pawns and others, and they all look good now and I could still increase TT cache coverage significantly. Scratch 3 required special handling again due to limited search depth. One can see all of that in yesterdays github change history:

https://github.com/ArnoHue/scratch/commits/master/chess/Engine.scratch

Last edited by ArnoHu (March 31, 2024 07:26:52)

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

birdracerthree wrote:

I’ve had enough stalling… I’m switching to list-contains in the evaluation and removing mate evaluations entirely unless a mate is found. Then, the TTable is toggled off and mate evals are turned on (or I gradually reduce the depth with the TTable List-Contains). Element desperately needs LMR to keeps up with White Dove’s tactical vision. Thoughts?

Not sure I understand correctly about TT mate evaluations, but I know they can be challenging. LMR is important from a certain search depth on.
birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

birdracerthree wrote:

I’ve had enough stalling… I’m switching to list-contains in the evaluation and removing mate evaluations entirely unless a mate is found. Then, the TTable is toggled off and mate evals are turned on (or I gradually reduce the depth with the TTable List-Contains). Element desperately needs LMR to keeps up with White Dove’s tactical vision. Thoughts?

Not sure I understand correctly about TT mate evaluations, but I know they can be challenging. LMR is important from a certain search depth on.
I can’t fix the TT mate eval issue, so I’m removing them when the TTable is on. The LMR is to keep up with White Dove’s search depth. Detecting king captures in the evaluation will cause issues…

Quick question; why are move generation lookups faster than the more standard method? The latter uses numerical calculations, so it should be faster.

Last edited by birdracerthree (March 31, 2024 19:01:36)

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

birdracerthree wrote:

ArnoHu wrote:

birdracerthree wrote:

I’ve had enough stalling… I’m switching to list-contains in the evaluation and removing mate evaluations entirely unless a mate is found. Then, the TTable is toggled off and mate evals are turned on (or I gradually reduce the depth with the TTable List-Contains). Element desperately needs LMR to keeps up with White Dove’s tactical vision. Thoughts?

Not sure I understand correctly about TT mate evaluations, but I know they can be challenging. LMR is important from a certain search depth on.
I can’t fix the TT mate eval issue, so I’m removing them when the TTable is on. The LMR is to keep up with White Dove’s search depth. Detecting king captures in the evaluation will cause issues…

Quick question; why are move generation lookups faster than the more standard method? The latter uses numerical calculations, so it should be faster.

Hm, the standard move generation method on any other platform would be bitboards. As we don't have 64bit integers nor bitwise ops, what comes closest are precalculated lookup tables, as they limit the number of Scratch blocks invoked, which is the most important performance factor on Scratch 3. On TurboWarp that is not the case, but lookup tables should also be faster than additional logic code.
birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

birdracerthree wrote:

ArnoHu wrote:

birdracerthree wrote:

I’ve had enough stalling… I’m switching to list-contains in the evaluation and removing mate evaluations entirely unless a mate is found. Then, the TTable is toggled off and mate evals are turned on (or I gradually reduce the depth with the TTable List-Contains). Element desperately needs LMR to keeps up with White Dove’s tactical vision. Thoughts?

Not sure I understand correctly about TT mate evaluations, but I know they can be challenging. LMR is important from a certain search depth on.
I can’t fix the TT mate eval issue, so I’m removing them when the TTable is on. The LMR is to keep up with White Dove’s search depth. Detecting king captures in the evaluation will cause issues…

Quick question; why are move generation lookups faster than the more standard method? The latter uses numerical calculations, so it should be faster.

Hm, the standard move generation method on any other platform would be bitboards. As we don't have 64bit integers nor bitwise ops, what comes closest are precalculated lookup tables, as they limit the number of Scratch blocks invoked, which is the most important performance factor on Scratch 3. On TurboWarp that is not the case, but lookup tables should also be faster than additional logic code.
Ok, why are lookup tables faster than using operators? A lookup table is put into a Boolean, but a small set of operators should be faster (mod for edge detection for example).
ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

birdracerthree wrote:

ArnoHu wrote:

birdracerthree wrote:

ArnoHu wrote:

birdracerthree wrote:

I’ve had enough stalling… I’m switching to list-contains in the evaluation and removing mate evaluations entirely unless a mate is found. Then, the TTable is toggled off and mate evals are turned on (or I gradually reduce the depth with the TTable List-Contains). Element desperately needs LMR to keeps up with White Dove’s tactical vision. Thoughts?

Not sure I understand correctly about TT mate evaluations, but I know they can be challenging. LMR is important from a certain search depth on.
I can’t fix the TT mate eval issue, so I’m removing them when the TTable is on. The LMR is to keep up with White Dove’s search depth. Detecting king captures in the evaluation will cause issues…

Quick question; why are move generation lookups faster than the more standard method? The latter uses numerical calculations, so it should be faster.

Hm, the standard move generation method on any other platform would be bitboards. As we don't have 64bit integers nor bitwise ops, what comes closest are precalculated lookup tables, as they limit the number of Scratch blocks invoked, which is the most important performance factor on Scratch 3. On TurboWarp that is not the case, but lookup tables should also be faster than additional logic code.
Ok, why are lookup tables faster than using operators? A lookup table is put into a Boolean, but a small set of operators should be faster (mod for edge detection for example).

I don't know what you mean by “A lookup table is put into a Boolean”. We would have to compare concrete alternative approaches to discuss them. In general, a lookup table contains already the outcome that code logic would have to produce, time and again, during move generation.
ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

In the latest GoK version, I reduced the effect of mobility evaluation significantly. I think it simply generated too much noise. The mistake was that I tried which values would prevent trapped queens or rooks, but the same values might just screw up positional evaluation when there is no real danger despite reduced mobility.

In a first test game, GoK (Medium, white) took on Element (6+8), and played a perfect game, winning in 40 moves. Element played great too, its only blunder was not considering en-passant: https://lichess.org/fUuTd7NV#79
ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

In the latest GoK version, I reduced the effect of mobility evaluation significantly. I think it simply generated too much noise. The mistake was that I tried which values would prevent trapped queens or rooks, but the same values might just screw up positional evaluation when there is no real danger despite reduced mobility.

In a first test game, GoK (Medium, white) took on Element (6+8), and played a perfect game, winning in 40 moves. Element played great too, its only blunder was not considering en-passant: https://lichess.org/fUuTd7NV#79

Next game against White Dove (P4), one GoK mistake at move 39, which won't happen on Difficult, otherwise a fine game. GoK wins it at 93%: https://lichess.org/aMRTvOU7#107
S_P_A_R_T
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

White Dove v7.05 Has Been Released!

This version fixed a few bugs with q-search that has caused inaccurate searches ever since I increased how much the piece values affect the evaluation function! I also added some minor improvements to the eval function, which combined with the q-search fix, should make this version a lot stronger than v7.04!

(The en-passant bug has also hopefully been fixed too!)

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!

S_P_A_R_T
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

ArnoHu wrote:

In the latest GoK version, I reduced the effect of mobility evaluation significantly. I think it simply generated too much noise. The mistake was that I tried which values would prevent trapped queens or rooks, but the same values might just screw up positional evaluation when there is no real danger despite reduced mobility.

In a first test game, GoK (Medium, white) took on Element (6+8), and played a perfect game, winning in 40 moves. Element played great too, its only blunder was not considering en-passant: https://lichess.org/fUuTd7NV#79

Next game against White Dove (P4), one GoK mistake at move 39, which won't happen on Difficult, otherwise a fine game. GoK wins it at 93%: https://lichess.org/aMRTvOU7#107

I've tested WD v7.05 (which just got released) and it seems to find the miracle draw here!

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

S_P_A_R_T wrote:

ArnoHu wrote:

ArnoHu wrote:

In the latest GoK version, I reduced the effect of mobility evaluation significantly. I think it simply generated too much noise. The mistake was that I tried which values would prevent trapped queens or rooks, but the same values might just screw up positional evaluation when there is no real danger despite reduced mobility.

In a first test game, GoK (Medium, white) took on Element (6+8), and played a perfect game, winning in 40 moves. Element played great too, its only blunder was not considering en-passant: https://lichess.org/fUuTd7NV#79

Next game against White Dove (P4), one GoK mistake at move 39, which won't happen on Difficult, otherwise a fine game. GoK wins it at 93%: https://lichess.org/aMRTvOU7#107

I've tested WD v7.05 (which just got released) and it seems to find the miracle draw here!

Which draw, after move 39? Cool! Seems I will have to run GoK Difficult against WD in the future :-)

GoK (competition mode, white) drew against Stockfish 16 level 7 in this game of high accuracy, being up two pawns, but then had to shift into defense mode: https://lichess.org/PFPTihNR#127

GoK seems to be able to draw against level 7 on a constant basis now, something that was not really the case before.

Last edited by ArnoHu (April 1, 2024 04:44:18)

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

Will focus a bit more on Scratch 3 again, as this is the runtime 95% of users will be running on.

Some sabretooth evaluation pattern here due to limited search depth, with GoK (Medium, white) taking on Element (3+8). Still not a bad game, which GoK wins by grinding down Element slowly in 88 moves: https://lichess.org/Oc6TqBqn#175

WD (P2) was up until move 17 against GoK (Medium, white), when it started blundering and lost in 27 moves: https://lichess.org/A6KvSPr5#53

Last edited by ArnoHu (April 1, 2024 06:53:00)

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

Earlier today I uploaded a GoK version which calculates attack tables before EVERY full search move generator run (OK not every run, as attack tables are cached in transposition table), something I had disabled years ago due to performance reasons. But GoK is faster today, and this approach allows its staged move generator to find all MVV/LVA captures with specialized code taking only a fraction of time; in addition, move ordering is better, hence pruning / LMR is better, king ring attacks will always be up-to-date for evaluation. Overall search performance stayed the same, but search quality has improved.

As a side-effect, average MPS on TurboWarp fell from 250,000 to 200,000, and NPS from 200,000 to 150,000 (although we are reaching the same search depth as before). Attack tables are created based on generated moves though, so just for fun I temporarily added attacks to MPS statistics - and it went up to 750,000 MPS.


With recent changes, GoK is back to 200k NPS average on my reference board for perf statistics. Scurious 1.3 shows 265k NPS for the same board on ply 5.

Last edited by ArnoHu (April 1, 2024 07:16:34)

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

Scratch Chess Engine Ranking 01.04.2024 (Scratch 3 Runtime)

Rank	Name		Elo	+	-	games	score	oppo.	draws
1 GoK 1738 155 119 29 100% 39 0%
2 Element 1516 188 239 8 25% 319 0%
3 Bonsai 1512 172 166 11 55% 152 0%
4 White Dove 1415 176 184 10 40% 150 0%
5 Archimedes 1402 169 166 10 50% 93 20%
6 HarleyK 1343 264 314 4 25% 194 0%
7 The Turk 1332 207 240 7 29% 131 0%
8 Shallow Blue 1330 204 204 5 50% 7 20%
9 Frenchgamerlol 1320 244 252 4 38% 58 25%
10 LowDoor 1318 222 229 5 40% 52 0%
11 Chip 1305 197 230 6 25% 97 17%
12 Scurious 1298 190 190 5 50% -50 60%
13 Wolverine 1282 311 474 3 0% 248 0%
14 Pseudo 1274 337 481 2 0% 184 0%
15 U0 1242 348 483 2 0% 178 0%
16 Mystery 1189 275 403 3 0% 117 0%
17 Midecah 1135 255 411 4 0% 92 0%

Last edited by ArnoHu (April 1, 2024 08:00:53)

Powered by DjangoBB