Discuss Scratch

birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

HasiLover_Test wrote:

Quick Question, how fast is Scurious( Calculation time not Np/s) on your computers? Im very scared to add anything or evaluation tweaks because Im scared that its too slow.
Scurious’ ply 4 think time on Scratch and its ply 5 think time on Turbowarp is excellent (ply 4 on Scratch is faster than 4+8 Element on Scratch). I think you should add quiescence to your engine. The top 3 engines all have quiescence.

Quick Note : To compare Scurious’ evaluation, you need to divide it by 10. Only the displayed evaluation needs to be scaled down; fhe evaluation bar works fine.
HasiLover_Test
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

Scurious 2(unreleased) accidentaly stalemates Thunder Shark up a Queen and Rook: https://lichess.org/UzyQS7Lf#105

Last edited by HasiLover_Test (March 22, 2024 16:16:20)

key-lock
Scratcher
19 posts

Scratch Chess Engine - Game of Kings

LockFish (WIP) is now out. I'm working on the minimax
here is the link: https://scratch.mit.edu/projects/985023263/

█▄▀ █▀▀ █▄█ █░░ █▀█ █▀▀ █▄▀
█░█ ██▄ ░█░ █▄▄ █▄█ █▄▄ █░█

when I receive [question v]
repeat until <(answer) = (correct answer)>
think (answer)
end
add (answer) to [forum v]

hi! i'm key-lock, I hope this forum post helped. I enjoy math, coding, and playing chess
check my projects out here
birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

HasiLover_Test wrote:

Scurious 2(unreleased) accidentaly stalemates Thunder Shark up a Queen and Rook: https://lichess.org/UzyQS7Lf#105
What’s in Scurious 2? Did you add quiescence? Did you fix Scurious’ play with the white pieces?
HasiLover_Test
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

birdracerthree wrote:

HasiLover_Test wrote:

Scurious 2(unreleased) accidentaly stalemates Thunder Shark up a Queen and Rook: https://lichess.org/UzyQS7Lf#105
What’s in Scurious 2? Did you add quiescence? Did you fix Scurious’ play with the white pieces?
Only Some evaluation function additions and MVV-LVA
HasiLover_Test
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

Scurious 2 will also contain 2 different Ranklists, 1 for S3 and another one for TW
ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

@S_P_A_R_T, with user playing black, Perf=2, importing “2bq1bnr/2p1k2p/2B2pp1/p2pP1B1/3P4/3Q1N2/PrP2PPP/R4RK1 w - - 0 14”, White Dove captures its own g5 bishop with a suddenly appearing black f4 pawn, moving backwards.

In general WD is pretty unplayable on Scratch 3 with P=2, hardly any game without these issues. That is why I could not run it any more for the Scratch 3 ranking.

Last edited by ArnoHu (March 23, 2024 10:28:08)

ArnoHu
Scratcher
1000+ posts

Scratch Chess Engine - Game of Kings

HasiLover_Test wrote:

Scurious 2 will also contain 2 different Ranklists, 1 for S3 and another one for TW

Haha, same idea again, currently preparing a study: https://lichess.org/study/v3EKTlR2
S_P_A_R_T
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

ArnoHu wrote:

@S_P_A_R_T, with user playing black, Perf=2, importing “2bq1bnr/2p1k2p/2B2pp1/p2pP1B1/3P4/3Q1N2/PrP2PPP/R4RK1 w - - 0 14”, White Dove captures its own g5 bishop with a suddenly appearing black f4 pawn, moving backwards.

In general WD is pretty unplayable on Scratch 3 with P=2, hardly any game without these issues. That is why I could not run it any more for the Scratch 3 ranking.

I see, I will investigate this strange bug.

(The bug only seems to occur on S3, even when I disable the search depth limiting code. Strange…)

Last edited by S_P_A_R_T (March 23, 2024 10:50:49)


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

Scratch Chess Engine Ranking (on Scratch 3 Runtime)

Based on this lichess.org study: https://lichess.org/study/v3EKTlR2/ , calculated using the BayesELO tool. Data from games of recent two years, and I ran some more in addition.

Rank	Name		Elo	+	-	games	score	oppo.	draws
1 GoK 1746 159 125 20 100% 0 0%
2 Element 1659 303 269 3 67% 141 0%
3 Bonsai 1604 167 158 10 60% 111 0%
4 Archimedes 1530 264 266 4 50% 100 0%
5 Shallow Blue 1514 262 238 3 67% 21 0%
6 The Turk 1475 210 240 6 33% 124 0%
7 LowDoor 1466 241 237 4 50% 43 0%
8 Chip 1430 235 283 4 25% 106 0%
9 Pseudo 1423 296 438 2 0% 180 0%
10 White Dove 1421 259 411 3 0% 220 0%
11 HarleyK 1393 258 311 4 25% 132 0%
12 Scurious 1386 305 303 2 50% -55 0%
13 Wolverine 1385 279 446 3 0% 203 0%
14 U0 1366 314 461 2 0% 156 0%
15 Frenchgamerlol 1345 284 301 3 33% 19 0%
16 Midecah 1276 232 338 4 0% 84 0%
17 Mystery 1230 268 386 3 0% 45 0%

Data is still limited, too few games played. Bottom ELO numbers should be even lower, some rankings certainly wrong - Archimedes, The Turk too high, White Dove too low (currently facing some Scratch 3 issues). Midecah is the engine which has never drawn let alone won a game and should be last.

BTW, Midecah was very close to a repetition draw against Scurious right now. I started even crossing fingers for Midecah, like a once in a lifetime chance, but no - instead of making the next identical check-evasion, it chose not to.

Thundershark is not in the list, because it was designed for TurboWarp only. U0 has been taken offline it seems.

You can find the engines in this studio: https://scratch.mit.edu/studios/15896412/

Last edited by ArnoHu (March 23, 2024 12:53:41)

key-lock
Scratcher
19 posts

Scratch Chess Engine - Game of Kings

is there any definite way to tell when endgame starts? (i can tell when I play, but I want it for my engine)
i'm using the StockFish piece values, which change depending on endgame or middlegame/opening:

midgame values:
pawn=126
knight=781
bishop=825
rook=1276
queen=2538

endgame value:
pawn=208
knight=854
bishop=915
rook=1380
queen=2682

also, how do you decide on these values? I know centipawns is a common unit.
another method I tried was calculating the mobility of each piece (how many squares it can move to from the middle of the board):
queen=27
rook=14
bishop=13
knight=8
pawn=3
using this method, the king would be 8, but since you have to cancel out moves that get you checked, king=16(3)+4(8)+4(13)+4(14)+18(27)=674

█▄▀ █▀▀ █▄█ █░░ █▀█ █▀▀ █▄▀
█░█ ██▄ ░█░ █▄▄ █▄█ █▄▄ █░█

when I receive [question v]
repeat until <(answer) = (correct answer)>
think (answer)
end
add (answer) to [forum v]

hi! i'm key-lock, I hope this forum post helped. I enjoy math, coding, and playing chess
check my projects out here
HasiLover_Test
Scratcher
100+ posts

Scratch Chess Engine - Game of Kings

key-lock wrote:

is there any definite way to tell when endgame starts? (i can tell when I play, but I want it for my engine)
i'm using the StockFish piece values, which change depending on endgame or middlegame/opening:

midgame values:
pawn=126
knight=781
bishop=825
rook=1276
queen=2538

endgame value:
pawn=208
knight=854
bishop=915
rook=1380
queen=2682

also, how do you decide on these values? I know centipawns is a common unit.
another method I tried was calculating the mobility of each piece (how many squares it can move to from the middle of the board):
queen=27
rook=14
bishop=13
knight=8
pawn=3
using this method, the king would be 8, but since you have to cancel out moves that get you checked, king=16(3)+4(8)+4(13)+4(14)+18(27)=674
Id say once the players both only have 2 minor pieces or 1 major piece left. (Pawn amount doesnt matter)
birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

HasiLover_Test wrote:

key-lock wrote:

is there any definite way to tell when endgame starts? (i can tell when I play, but I want it for my engine)
i'm using the StockFish piece values, which change depending on endgame or middlegame/opening:

midgame values:
pawn=126
knight=781
bishop=825
rook=1276
queen=2538

endgame value:
pawn=208
knight=854
bishop=915
rook=1380
queen=2682

also, how do you decide on these values? I know centipawns is a common unit.
another method I tried was calculating the mobility of each piece (how many squares it can move to from the middle of the board):
queen=27
rook=14
bishop=13
knight=8
pawn=3
using this method, the king would be 8, but since you have to cancel out moves that get you checked, king=16(3)+4(8)+4(13)+4(14)+18(27)=674
Id say once the players both only have 2 minor pieces or 1 major piece left. (Pawn amount doesnt matter)
This doesn't include BNNvBNN, RRvRR, BBNNvBBNN, and more. This is how Element does it :
if 3N+3B+5R+9Q<27 or Q=2 and Q+R+2 = PieceCount-P then
Endgame =1

N is number of knights, B is number of bishops, etc. The second part of the boolean is used to detect if there are no minor pieces left (although allowing QRRvQRR to count as an endgame removes Element's pawn sheild. This has caused issues here - https://lichess.org/study/PgtRI4b6/BCzCiPI4#76).

Alternatively, you can use the material value and interpolate between early middlegame and late endgame. For example, the pawn value would be *(-41/31)*x+208, where x is the total material (x starts at 62 in the beginning of the game ignoring pawns).

How are these calculated? Well, the standard beginners are taught is {1,3,3,5,9}. However, this can causing BNvRP exchanges, which is bad (BN>RP). In chess engines, the standard is {1,3.2,3.3,5,9}, with the knight sometimes being 3.1 instead. Element is switching to {1,3.9,4.1,6,12} soon (variant of {1,4,4,6,12} to help stop BNvRP exchanges).

Last edited by birdracerthree (March 23, 2024 19:36:02)

key-lock
Scratcher
19 posts

Scratch Chess Engine - Game of Kings

thanks

█▄▀ █▀▀ █▄█ █░░ █▀█ █▀▀ █▄▀
█░█ ██▄ ░█░ █▄▄ █▄█ █▄▄ █░█

when I receive [question v]
repeat until <(answer) = (correct answer)>
think (answer)
end
add (answer) to [forum v]

hi! i'm key-lock, I hope this forum post helped. I enjoy math, coding, and playing chess
check my projects out here
birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

key-lock wrote:

thanks
Happy to help!

I should note that the pawn is usually assigned a value of 1 (hence the centipawn value), so you can scale down the material values is you want
key-lock
Scratcher
19 posts

Scratch Chess Engine - Game of Kings

birdracerthree wrote:

HasiLover_Test wrote:

key-lock wrote:

is there any definite way to tell when endgame starts? (i can tell when I play, but I want it for my engine)
i'm using the StockFish piece values, which change depending on endgame or middlegame/opening:

midgame values:
pawn=126
knight=781
bishop=825
rook=1276
queen=2538

endgame value:
pawn=208
knight=854
bishop=915
rook=1380
queen=2682

also, how do you decide on these values? I know centipawns is a common unit.
another method I tried was calculating the mobility of each piece (how many squares it can move to from the middle of the board):
queen=27
rook=14
bishop=13
knight=8
pawn=3
using this method, the king would be 8, but since you have to cancel out moves that get you checked, king=16(3)+4(8)+4(13)+4(14)+18(27)=674
Id say once the players both only have 2 minor pieces or 1 major piece left. (Pawn amount doesnt matter)
This doesn't include BNNvBNN, RRvRR, BBNNvBBNN, and more. This is how Element does it :
if 3N+3B+5R+9Q<27 or Q=2 and Q+R+2 = PieceCount-P then
Endgame =1

N is number of knights, B is number of bishops, etc. The second part of the boolean is used to detect if there are no minor pieces left (although allowing QRRvQRR to count as an endgame removes Element's pawn sheild. This has caused issues here - https://lichess.org/study/PgtRI4b6/BCzCiPI4#76).

Alternatively, you can use the material value and interpolate between early middlegame and late endgame. For example, the pawn value would be *(-41/31)*x+208, where x is the total material (x starts at 62 in the beginning of the game ignoring pawns).

How are these calculated? Well, the standard beginners are taught is {1,3,3,5,9}. However, this can causing BNvRP exchanges, which is bad (BN>RP). In chess engines, the standard is {1,3.2,3.3,5,9}, with the knight sometimes being 3.1 instead. Element is switching to {1,3.9,4.1,6,12} soon (variant of {1,4,4,6,12} to help stop BNvRP exchanges).
I noticed that in the 1st part of the boolean, it essentially was if the standard piece value of the board (except for pawns)<27
for my values, that would be 6961.02188 on average (not taking pawns into account). I already have a board evaluation function, so I'll change it to
(board value)<7,000

█▄▀ █▀▀ █▄█ █░░ █▀█ █▀▀ █▄▀
█░█ ██▄ ░█░ █▄▄ █▄█ █▄▄ █░█

when I receive [question v]
repeat until <(answer) = (correct answer)>
think (answer)
end
add (answer) to [forum v]

hi! i'm key-lock, I hope this forum post helped. I enjoy math, coding, and playing chess
check my projects out here
birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

key-lock wrote:

birdracerthree wrote:

HasiLover_Test wrote:

key-lock wrote:

is there any definite way to tell when endgame starts? (i can tell when I play, but I want it for my engine)
i'm using the StockFish piece values, which change depending on endgame or middlegame/opening:

midgame values:
pawn=126
knight=781
bishop=825
rook=1276
queen=2538

endgame value:
pawn=208
knight=854
bishop=915
rook=1380
queen=2682

also, how do you decide on these values? I know centipawns is a common unit.
another method I tried was calculating the mobility of each piece (how many squares it can move to from the middle of the board):
queen=27
rook=14
bishop=13
knight=8
pawn=3
using this method, the king would be 8, but since you have to cancel out moves that get you checked, king=16(3)+4(8)+4(13)+4(14)+18(27)=674
Id say once the players both only have 2 minor pieces or 1 major piece left. (Pawn amount doesnt matter)
This doesn't include BNNvBNN, RRvRR, BBNNvBBNN, and more. This is how Element does it :
if 3N+3B+5R+9Q<27 or Q=2 and Q+R+2 = PieceCount-P then
Endgame =1

N is number of knights, B is number of bishops, etc. The second part of the boolean is used to detect if there are no minor pieces left (although allowing QRRvQRR to count as an endgame removes Element's pawn sheild. This has caused issues here - https://lichess.org/study/PgtRI4b6/BCzCiPI4#76).

Alternatively, you can use the material value and interpolate between early middlegame and late endgame. For example, the pawn value would be *(-41/31)*x+208, where x is the total material (x starts at 62 in the beginning of the game ignoring pawns).

How are these calculated? Well, the standard beginners are taught is {1,3,3,5,9}. However, this can causing BNvRP exchanges, which is bad (BN>RP). In chess engines, the standard is {1,3.2,3.3,5,9}, with the knight sometimes being 3.1 instead. Element is switching to {1,3.9,4.1,6,12} soon (variant of {1,4,4,6,12} to help stop BNvRP exchanges).
I noticed that in the 1st part of the boolean, it essentially was if the standard piece value of the board (except for pawns)<27
for my values, that would be 6961.02188 on average (not taking pawns into account). I already have a board evaluation function, so I'll change it to
(board value)<7,000
Max value this has is 62 at the start of the game. The function is not dependent on the piece values of the engine.
key-lock
Scratcher
19 posts

Scratch Chess Engine - Game of Kings

also, did you mean if <3N+3B+5R+9Q<27> or <Q=2 and Q+R+2>
= PieceCount-P then

or if <3N+3B+5R+9Q<27 or Q=2> and <Q+R+2>
= PieceCount-P then

the 1st one makes more sense

█▄▀ █▀▀ █▄█ █░░ █▀█ █▀▀ █▄▀
█░█ ██▄ ░█░ █▄▄ █▄█ █▄▄ █░█

when I receive [question v]
repeat until <(answer) = (correct answer)>
think (answer)
end
add (answer) to [forum v]

hi! i'm key-lock, I hope this forum post helped. I enjoy math, coding, and playing chess
check my projects out here
key-lock
Scratcher
19 posts

Scratch Chess Engine - Game of Kings

birdracerthree wrote:

key-lock wrote:

birdracerthree wrote:

HasiLover_Test wrote:

key-lock wrote:

is there any definite way to tell when endgame starts? (i can tell when I play, but I want it for my engine)
i'm using the StockFish piece values, which change depending on endgame or middlegame/opening:

midgame values:
pawn=126
knight=781
bishop=825
rook=1276
queen=2538

endgame value:
pawn=208
knight=854
bishop=915
rook=1380
queen=2682

also, how do you decide on these values? I know centipawns is a common unit.
another method I tried was calculating the mobility of each piece (how many squares it can move to from the middle of the board):
queen=27
rook=14
bishop=13
knight=8
pawn=3
using this method, the king would be 8, but since you have to cancel out moves that get you checked, king=16(3)+4(8)+4(13)+4(14)+18(27)=674
Id say once the players both only have 2 minor pieces or 1 major piece left. (Pawn amount doesnt matter)
This doesn't include BNNvBNN, RRvRR, BBNNvBBNN, and more. This is how Element does it :
if 3N+3B+5R+9Q<27 or Q=2 and Q+R+2 = PieceCount-P then
Endgame =1

N is number of knights, B is number of bishops, etc. The second part of the boolean is used to detect if there are no minor pieces left (although allowing QRRvQRR to count as an endgame removes Element's pawn sheild. This has caused issues here - https://lichess.org/study/PgtRI4b6/BCzCiPI4#76).

Alternatively, you can use the material value and interpolate between early middlegame and late endgame. For example, the pawn value would be *(-41/31)*x+208, where x is the total material (x starts at 62 in the beginning of the game ignoring pawns).

How are these calculated? Well, the standard beginners are taught is {1,3,3,5,9}. However, this can causing BNvRP exchanges, which is bad (BN>RP). In chess engines, the standard is {1,3.2,3.3,5,9}, with the knight sometimes being 3.1 instead. Element is switching to {1,3.9,4.1,6,12} soon (variant of {1,4,4,6,12} to help stop BNvRP exchanges).
I noticed that in the 1st part of the boolean, it essentially was if the standard piece value of the board (except for pawns)<27
for my values, that would be 6961.02188 on average (not taking pawns into account). I already have a board evaluation function, so I'll change it to
(board value)<7,000
Max value this has is 62 at the start of the game. The function is not dependent on the piece values of the engine.
ok, but do I need variables for it? I meant that since I already had a board eval. function, I wanted to modify the boolean to be easier. my board starts at 18620 (not including my engine's values for kings/negative values for opposite colors). also, isn't the starting piece value 78, 79.2, or 96 (depending on which definition you used).

█▄▀ █▀▀ █▄█ █░░ █▀█ █▀▀ █▄▀
█░█ ██▄ ░█░ █▄▄ █▄█ █▄▄ █░█

when I receive [question v]
repeat until <(answer) = (correct answer)>
think (answer)
end
add (answer) to [forum v]

hi! i'm key-lock, I hope this forum post helped. I enjoy math, coding, and playing chess
check my projects out here
birdracerthree
Scratcher
500+ posts

Scratch Chess Engine - Game of Kings

key-lock wrote:

also, did you mean if <3N+3B+5R+9Q<27> or <Q=2 and Q+R+2>
= PieceCount-P then

or if <3N+3B+5R+9Q<27 or Q=2> and <Q+R+2>
= PieceCount-P then

the 1st one makes more sense
I meant the first one. Thanks for pointing that out.

Powered by DjangoBB