Discuss Scratch
- Discussion Forums
- » Show and Tell
- » Scratch Chess Engine - Game of Kings
- Grijfland
-
100+ posts
Scratch Chess Engine - Game of Kings
“My feeling was that Bonsai still had a bit of an advantage (esp. creativity of moves), but GoK had about 1/3 lower think time, so that's something that could be used” 
This match showes good the differents between the AI of GoK and Bonsai. (passive and active -pawns-)
I have made the openings in this line completely adapted, because 5236 also included 2x (?!?) :
This is now the right one:
523612286346021958431321533707223729221259310613
d4-d5/Nf3-Nc6/Nc3-e6/e4-Nf6/e5-Nd7/Bg5-Be7/

This match showes good the differents between the AI of GoK and Bonsai. (passive and active -pawns-)

I have made the openings in this line completely adapted, because 5236 also included 2x (?!?) :
This is now the right one:
523612286346021958431321533707223729221259310613
d4-d5/Nf3-Nc6/Nc3-e6/e4-Nf6/e5-Nd7/Bg5-Be7/
- Grijfland
-
100+ posts
Scratch Chess Engine - Game of Kings
I have found in my archive (30 years ago
) an abbreviated table of the approximate numerical values assigned to a variety of possible moves:
1) Doubled pawns -15
2) Tripled pawns -50
3) isolated pawns -45
4) Piece or pawn moved twice in the opening -15
5) Taking to moves instead of one to get to a square -15
6) Knight never moved -18
7) Knight in front of King's pawn or Queen's pawn -60
8) Bishop never moved -10
10) Bishop in front of King's pawn or Queen pawn -60
11) Rook moved before castling has occurred -100
12 King moved before castling has accurred -100
13 Casling missed, king is always in danger -50
14 Blockes pawns -7
15 Backwards pawns (Knight must become a Defender) -15
———++++——-
16 Two pawns next to each other +5
17 One pawn guarding another +18
18 Knight on opponent's side of the board +20
19 Same, with pawn guarding it +30
20 Bishop on strong diagonal +24
21 Rook on open file +30
22 Doubled Rooks on open file +85
23 Rook behind passed pawn +30
24 Castled King +150
25 Centre pawns +10
26 Bishops pair aiming at the enemy's king +20
27 Rook on seventh rank, two unmoved opposing pawns +50
28 Rook on seventh rank, three unmoved opp. pawns +100
29 Rook on seventh rank, four unmoved opposing pawns +150

1) Doubled pawns -15
2) Tripled pawns -50
3) isolated pawns -45
4) Piece or pawn moved twice in the opening -15
5) Taking to moves instead of one to get to a square -15
6) Knight never moved -18
7) Knight in front of King's pawn or Queen's pawn -60
8) Bishop never moved -10
10) Bishop in front of King's pawn or Queen pawn -60
11) Rook moved before castling has occurred -100
12 King moved before castling has accurred -100
13 Casling missed, king is always in danger -50
14 Blockes pawns -7
15 Backwards pawns (Knight must become a Defender) -15
———++++——-
16 Two pawns next to each other +5
17 One pawn guarding another +18
18 Knight on opponent's side of the board +20
19 Same, with pawn guarding it +30
20 Bishop on strong diagonal +24
21 Rook on open file +30
22 Doubled Rooks on open file +85
23 Rook behind passed pawn +30
24 Castled King +150
25 Centre pawns +10
26 Bishops pair aiming at the enemy's king +20
27 Rook on seventh rank, two unmoved opposing pawns +50
28 Rook on seventh rank, three unmoved opp. pawns +100
29 Rook on seventh rank, four unmoved opposing pawns +150
- ArnoHu
-
1000+ posts
Scratch Chess Engine - Game of Kings
I have found in my archive (30 years ago) an abbreviated table of the approximate numerical values assigned to a variety of possible moves:
Thank Grijfland, I will check those and see what else I can integrate. Several of those are already implemented, but with slightly different values.
Scratch Chess - Game of Kings

Last edited by ArnoHu (May 15, 2017 15:58:08)
- Remes_
-
27 posts
Scratch Chess Engine - Game of Kings
Hello. Can you make start positions with a handicap? White (men) has a complete set of figures. Black (comp) has one king. King and 1 pawn. King and two pawns. King and 4 6 8 pawns. From such positions children can start playing.
- ArnoHu
-
1000+ posts
Scratch Chess Engine - Game of Kings
Hello. Can you make start positions with a handicap? White (men) has a complete set of figures. Black (comp) has one king. King and 1 pawn. King and two pawns. King and 4 6 8 pawns. From such positions children can start playing.
Yes, that is possible. This is the board definition at the beginning:
500,310,330,900,20000,330,310,500,100,100,100,100,100,100,100,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-100,-100,-100,-100,-100,-100,-100,-100,-500,-310,-330,-900,-20000,-330,-310,-500,
Values greater than zero are black pieces, smaller than zero are white. You can adapt that board definition string as you please, then click “Import” and paste the string from your clipboard.
Or you may want to create a remix with pre-defined boards.
- Remes_
-
27 posts
Scratch Chess Engine - Game of Kings
Ha ha ha ))) https://scratch-mit-edu.ezproxyberklee.flo.org/projects/161096332/
May by add quene?
May by add quene?
- ArnoHu
-
1000+ posts
Scratch Chess Engine - Game of Kings
https://scratch-mit-edu.ezproxyberklee.flo.org/projects/161096332/Ha ha ha )))
May by add quene?
Nice, but I think you should disable the opening book then, as it expects a full board. E.g. look what happens when you play Ng1f3. You may want to check the InitOpeningBook function, and only clear the list, don't fill it.
- ArnoHu
-
1000+ posts
Scratch Chess Engine - Game of Kings
I did some performance tuning, which allowed me to switch to ply5 (think time taking around one minute). There is a prototype available at https://scratch-mit-edu.ezproxyberklee.flo.org/projects/161323175/ (Level “Difficult”) - it's probably the first Scratch chess implementation calculating 5 moves ahead (at least the only one I am aware of). There is still some more speedup potential in the code though.
I am curious how this will affect playing strength and would be happy about feedback (plus one on think-depth is nice, but not everything). Once it works fine, I will merge it back into the original version for Level “Difficult”.
Scratch Chess - Game of Kings

I am curious how this will affect playing strength and would be happy about feedback (plus one on think-depth is nice, but not everything). Once it works fine, I will merge it back into the original version for Level “Difficult”.
Scratch Chess - Game of Kings

Last edited by ArnoHu (May 19, 2017 06:11:29)
- ArnoHu
-
1000+ posts
Scratch Chess Engine - Game of Kings
The new implementation of Game of Kings at https://scratch-mit-edu.ezproxyberklee.flo.org/projects/161323175 now played three test matches on level “Difficult” against Bonsai ( https://scratch-mit-edu.ezproxyberklee.flo.org/projects/86498104 ), one of the strongest chess engines on Scratch, and won all three of them (albeit, at twice of Bonsai's think time). Level “Medium”, which is significantly faster, had a win, a draw and a loss against Bonsai.
After some more testing, this new GoK version will replace the current one at https://scratch-mit-edu.ezproxyberklee.flo.org/projects/148769358
Scratch Chess - Game of Kings

After some more testing, this new GoK version will replace the current one at https://scratch-mit-edu.ezproxyberklee.flo.org/projects/148769358
Scratch Chess - Game of Kings

Last edited by ArnoHu (June 7, 2017 09:21:29)
- Grijfland
-
100+ posts
Scratch Chess Engine - Game of Kings
Game of Kings (project #161323175) has just played a match against Bonsai (project #86498104) and won convincingly in 14 sets.
Bonsai (green-white) and GoK (difficult-black)
1 d4-d5 / 2 Bf4-Nf6 / 3 Qd3-Nc6 / 4 Kd2 ? - g5 ? / 5 Be5-NxBe5 / 6 dxNe5-Ne4 / 7 Ke3-e6 / 8 Nf3-g4 / 9 Nd4-c5 /10 Nb5-c4
11 Qd1-Qb6+ / 12 Nd4-Qxb2 / 13 Nd2-Bh6+ / f4-Qc3+# 0-1
Bonsai (green-white) and GoK (difficult-black)
1 d4-d5 / 2 Bf4-Nf6 / 3 Qd3-Nc6 / 4 Kd2 ? - g5 ? / 5 Be5-NxBe5 / 6 dxNe5-Ne4 / 7 Ke3-e6 / 8 Nf3-g4 / 9 Nd4-c5 /10 Nb5-c4
11 Qd1-Qb6+ / 12 Nd4-Qxb2 / 13 Nd2-Bh6+ / f4-Qc3+# 0-1

- ArnoHu
-
1000+ posts
Scratch Chess Engine - Game of Kings
Game of Kings (project #161323175) has just played a match against Bonsai (project #86498104) and won convincingly in 14 sets.
Bonsai (green-white) and GoK (difficult-black)
1 d4-d5 / 2 Bf4-Nf6 / 3 Qd3-Nc6 / 4 Kd2 ? - g5 ? / 5 Be5-NxBe5 / 6 dxNe5-Ne4 / 7 Ke3-e6 / 8 Nf3-g4 / 9 Nd4-c5 /10 Nb5-c4
11 Qd1-Qb6+ / 12 Nd4-Qxb2 / 13 Nd2-Bh6+ / f4-Qc3+# 0-1
Thanks for the test, Grijfland. I have not seen such a quick win yet. Scratch Chess - Game of Kings has now been updated to the new version. Level “Difficult” is only recommended on modern hardware though, as it may require quite some think time.
- ArnoHu
-
1000+ posts
Scratch Chess Engine - Game of Kings
BTW, I also implemented your suggestion of being able to “Undo” a move even after the end of the game.
- Grijfland
-
100+ posts
Scratch Chess Engine - Game of Kings
ArnoHu (and Samueldora),
I also have a match against Bonsai, where Scratch Chess - Game of Kings plays on the strength of "medium". This match ends in a reminder of repetition ! Very neatly indicated by both engines !
I also have a match against Bonsai, where Scratch Chess - Game of Kings plays on the strength of "medium". This match ends in a reminder of repetition ! Very neatly indicated by both engines !

- ArnoHu
-
1000+ posts
Scratch Chess Engine - Game of Kings
ArnoHu (and Samueldora),
I also have a match against Bonsai, where Scratch Chess - Game of Kings plays on the strength of "medium". This match ends in a reminder of repetition ! Very neatly indicated by both engines !
Thanks, good to hear! I let it play two more test games, and Game of Kings (level “Difficult”) won both.
On fast hardware I consider think time to be quite high, but acceptable given what it is doing (looking five to six moves ahead). On older hardware I personally wouldn't play the highest difficulty level.
Scratch Chess - Game of Kings

Last edited by ArnoHu (June 14, 2017 13:41:44)
- ArnoHu
-
1000+ posts
Scratch Chess Engine - Game of Kings
Game adoption
Nearly 2000 users have played Chess - Game of Kings so far. Thank you, and I hope you like it.
New level “Difficult” implementation
Who has won against the new “Difficult” level implementation (ply5/6) already? If so, I would be very interested in your move list.
Request for Enhancements
The two most-requested new features are:
Scratch Chess - Game of Kings

Nearly 2000 users have played Chess - Game of Kings so far. Thank you, and I hope you like it.
New level “Difficult” implementation
Who has won against the new “Difficult” level implementation (ply5/6) already? If so, I would be very interested in your move list.
Request for Enhancements
The two most-requested new features are:
- Select piece for pawn-promotion (instead of defaulting to a queen)
- Let the human player take the black side
Scratch Chess - Game of Kings

- Grijfland
-
100+ posts
Scratch Chess Engine - Game of Kings
Game adoption
Nearly 2000 users have played Chess - Game of Kings so far. Thank you, and I hope you like it.
New level “Difficult” implementation
Who has won against the new “Difficult” level implementation (ply5/6) already? If so, I would be very interested in your move list.
Request for Enhancements
The two most-requested new features are:If you have feature ideas, please let me know in this forum thread or via the project comment section. Thank you!
- Select piece for pawn-promotion (instead of defaulting to a queen)
- Let the human player take the black side
Scratch Chess - Game of Kings
1) Setup position
2) Puzzles / Practice
3) Hint
4) Sound when GoK moves
5) Flip board
7) Blindfold mode
8) Captured pieces
9) Force GoK into a move.
- ArnoHu
-
1000+ posts
Scratch Chess Engine - Game of Kings
We are quickly approaching 100 love clicks, which makes this the last opportunity to suggest the project for being featured on Scratch via forum thread https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/topic/245007/
If you are so inclined, please simply write a line or two on https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/topic/245007/ why you like “Chess - Game of Kings”, and paste a link to the project ( https://scratch-mit-edu.ezproxyberklee.flo.org/projects/148769358/ ) into the same posting. I would appreciate it.
Thank you!
Scratch Chess - Game of Kings

If you are so inclined, please simply write a line or two on https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/topic/245007/ why you like “Chess - Game of Kings”, and paste a link to the project ( https://scratch-mit-edu.ezproxyberklee.flo.org/projects/148769358/ ) into the same posting. I would appreciate it.
Thank you!
Scratch Chess - Game of Kings

- ArnoHu
-
1000+ posts
Scratch Chess Engine - Game of Kings
https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/topic/245007/We are quickly approaching 100 love clicks, which makes this the last opportunity to suggest the project for being featured on Scratch via forum thread
If you are so inclined, please simply write a line or two on https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/topic/245007/ why you like “Chess - Game of Kings”, and paste a link to the project ( https://scratch-mit-edu.ezproxyberklee.flo.org/projects/148769358/ ) into the same posting. I would appreciate it.
Thank you!
Scratch Chess - Game of Kings
Worth mentioning in a feature proposal might be that Game of Kings was originally developed for CoderDojo Linz, a programming club for children. Here is the chess programming tutorial: http://coderdojo-linz.github.io/trainingsanleitungen/scratch/scratch-chess.html (in German). I will provide an English version soon. In the meantime, this is Google's translation: https://goo.gl/2iErTa
- Remes_
-
27 posts
Scratch Chess Engine - Game of Kings
Hi. Can anybody create game 8pawns player VS 8 pawns computer? Who first get last row - winner.
Last edited by Remes_ (July 19, 2017 18:48:30)
- Discussion Forums
- » Show and Tell
-
» Scratch Chess Engine - Game of Kings