Discuss Scratch
- Discussion Forums
- » Show and Tell
- » Scratch Chess Engine - Game of Kings
- S_P_A_R_T
- Scratcher
500+ posts
Scratch Chess Engine - Game of Kings
Ok, glad you fixed it! I normally backup code by downloading it to my computer, or saving as a copy on Scratch
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!
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
Currently working on move generation in my engine despite the fact that I was trying to get negamax to work. The perft(3) at the starting position is reporting 8881 instead of 8902. I tried expanding so I see which moves are incorrect, but A. I don't have a list of correct move numbers and B. The move numbers aren't adding up.
- ArnoHu
- Scratcher
1000+ posts
Scratch Chess Engine - Game of Kings
Currently working on move generation in my engine despite the fact that I was trying to get negamax to work. The perft(3) at the starting position is reporting 8881 instead of 8902. I tried expanding so I see which moves are incorrect, but A. I don't have a list of correct move numbers and B. The move numbers aren't adding up.
Maybe a result of pseud-legal but non-legal moves, like pinned pieces moving? GoK does that the whole time, including king captures when not having moved out of check; it's how the deeper search works, the high penalty on a king captures auto-controls that the moves leading there will never be considered, if there are alternatives.
- ArnoHu
- Scratcher
1000+ posts
Scratch Chess Engine - Game of Kings
It works again ,the Probem was it made a Move which was lower than the eval,which every move was reset to 0,so if white had an advantage,it couldnt find any moves with an eval lower than 0.Technically its way more complicated than that,but im too lazy to explain.I fixed the Problem by evaluating the Board before it calculates the Moves.
Now i have to make it actually not take every Piece.
Great to hear! On thing, I can not really see the black pieces on black squares, can you tweak the contrast or add a white lining to them or similar? Thx!
- ArnoHu
- Scratcher
1000+ posts
Scratch Chess Engine - Game of Kings
GoK Chess Profiler Mode Explained
When a user presses “P”, GoK Chess will activate its so called profiler mode. Profiler mode provides insights into what the engine is doing, and how efficient it uses its limited think time. The more efficient the engine works, the better the playing strength. The profiler causes a certain amount of overhead itself, so the engine will be a bit slower. Press P again to deactivate profiler mode.
During and after move search in profiler mode, you can inspect profiler output by pressing “L” (for logfile) and “R” (for execution time metrics). The logfile might look something like this:
Log entries explained:
At 0.181 seconds, a new search run (part of iterative deepening) for 3 full plies (plus quiescence move) is started.
At 0.287 seconds, there was an indication for sub-optimal move ordering on full search depth 3. The best move had been ranked as number 7 in the ordered move list, it is for a black bishop (330), the move is 3406 (34 being the source square, 6 the target square), and the FEN board data for further analysis.
At 0.366 seconds, a new best move was found for full search depth 3. It is move 0634, and its evaluation is 54.
Move generation / Node traversal stats for the previous second. The numbers are for full search (FS) plus quiescence search (QS) combined. You can toggle this by pressing N to switch between profiling FS + QS, FS only, or QS only.
During the previous second, 2039 moves have been created by the move generator (MPS = moves-per-second). 1465 of those moves have been traversed (NPS = nodes-per-second). This means those moves were applied, and the resulting board was evaluated. Noteworthy is that while a high number of generated moves is good, it is much more important to generated the RIGHT moves, those that are worth of detailed analysis. E.g. Deep-learning chess AIs usually generate order-of-magnitude fewer moves than classic engines. It is a good sign when NPS is nearly as large as MPS, because we don't want to generate moves that are never traversed, this would be a waste of time. The staged move-generator takes care of that.
During the previous second, the best moves were at an average index of 1.23 within their ordered move lists. The closer to index 1, the better, because then principal search is fast, the best moves are found quickly, and pruning cut-offs will happen as early as possible. That number shows how good our move ordering works.
By pressing R, we can inspect execution time for move generation and evaluation by search depth. The list typically looks like this:
Section 1-30 shows the board evaluation execution time in seconds for ply 1 to 30, e.g. 0.391 seconds for ply 3. Section 31-60 refers to the core move generation time (full search) per ply (excluding early staged-move generator stages, like hash move lookup), e.g. 0.031 seconds for ply 3. The other sections are:
When a user presses “P”, GoK Chess will activate its so called profiler mode. Profiler mode provides insights into what the engine is doing, and how efficient it uses its limited think time. The more efficient the engine works, the better the playing strength. The profiler causes a certain amount of overhead itself, so the engine will be a bit slower. Press P again to deactivate profiler mode.
During and after move search in profiler mode, you can inspect profiler output by pressing “L” (for logfile) and “R” (for execution time metrics). The logfile might look something like this:
0.181: 3 : Search start, depth = 3
0.287: Move ordering indication: 3 : 7 : 330 : 3406 : rnbqk1nr/pppp1ppp/8/4p3/1b4Q1/4P2P/PPPP1PP1/RNB1KBNR
0.366: 3 : 0634 : 19
1.000: FS = true, QS = true
1.000: MPS = 2039, NPS = 1465
1.000: Avg. best move idx = 1.24
Log entries explained:
0.181: 3 : Search start, depth = 3
0.287: Move ordering indication: 3 : 7 : 330 : 3406 : rnbqk1nr/pppp1ppp/8/4p3/1b4Q1/4P2P/PPPP1PP1/RNB1KBNR
0.366: 3 : 0634 : 19
1.000: FS = true, QS = true
1.000: MPS = 2039, NPS = 1465
1.000: Avg. best move idx = 1.24
By pressing R, we can inspect execution time for move generation and evaluation by search depth. The list typically looks like this:
001: 0.027999520301818848
002: 0.06499958038330078
003: 0.3910008668899536
004: 0.694998025894165
005: 0.6069976091384888
[...]
031: 0.0030002593994140625
032: 0.0039997100830078125
033: 0.03199946880340576
034: 0.10299968719482422
035: 1.0379977226257324
[...]
Section 1-30 shows the board evaluation execution time in seconds for ply 1 to 30, e.g. 0.391 seconds for ply 3. Section 31-60 refers to the core move generation time (full search) per ply (excluding early staged-move generator stages, like hash move lookup), e.g. 0.031 seconds for ply 3. The other sections are:
- Section 61-90: core move generation time (quiescence search) per ply (excluding early staged-move generator stages), plies 1 to 30
- Section 91-120: attack table generation time, plies 1 to 30
- Section 151-180: combined move generation time (full search, quiescence search, staged move generator, additional overhead), plies 1 to 30
Last edited by ArnoHu (Sept. 1, 2023 04:58:12)
- birdracerthree
- Scratcher
500+ posts
Scratch Chess Engine - Game of Kings
I currently only have pseudo-legal moves, but that shouldn't matter because all legal moves in perft(3) are pseudo-legal.Currently working on move generation in my engine despite the fact that I was trying to get negamax to work. The perft(3) at the starting position is reporting 8881 instead of 8902. I tried expanding so I see which moves are incorrect, but A. I don't have a list of correct move numbers and B. The move numbers aren't adding up.
Maybe a result of pseud-legal but non-legal moves, like pinned pieces moving? GoK does that the whole time, including king captures when not having moved out of check; it's how the deeper search works, the high penalty on a king captures auto-controls that the moves leading there will never be considered, if there are alternatives.
- bittensboy
- Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
i know how to play chess
each pawn is assigned to a peice
pawns can move 1 or 2 on first turn and attack diaognal
rook can move anywhere in straight lines
bishops are basically the same as rooks but it's diaognal any instead of straights
knights move in an L-like shape, they have to move 1 or 2 for the L shape and has to be different, and they are the only peice that can jump over peices
queens can move anywhere diagonal or straight
kings can move 1 only in any direction
if a player's king gets captured, the opponent wins.
if the king is targeted, check!
if the king has nowhere to move to get out of check, checkmate!
each pawn is assigned to a peice
pawns can move 1 or 2 on first turn and attack diaognal
rook can move anywhere in straight lines
bishops are basically the same as rooks but it's diaognal any instead of straights
knights move in an L-like shape, they have to move 1 or 2 for the L shape and has to be different, and they are the only peice that can jump over peices
queens can move anywhere diagonal or straight
kings can move 1 only in any direction
if a player's king gets captured, the opponent wins.
if the king is targeted, check!
if the king has nowhere to move to get out of check, checkmate!
- bittensboy
- Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
compress this into a custom block i know how to play chess
each pawn is assigned to a peice
pawns can move 1 or 2 on first turn and attack diaognal
rook can move anywhere in straight lines
bishops are basically the same as rooks but it's diaognal any instead of straights
knights move in an L-like shape, they have to move 1 or 2 for the L shape and has to be different, and they are the only peice that can jump over peices
queens can move anywhere diagonal or straight
kings can move 1 only in any direction
if a player's king gets captured, the opponent wins.
if the king is targeted, check!
if the king has nowhere to move to get out of check, checkmate!
define (play chess)if somebody gonna write all of this you cant quote
. [the ways to do chess lol on the top of the post]::#000
Last edited by bittensboy (Aug. 19, 2023 17:37:28)
- HasiLover
- Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
I feel like the People here know how to play chess…
- HasiLover
- Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
I let my Engine play against Worstfish(Engine which tries to loose),it was a Stalemate…
Like People say,chess played Perfectly is a draw.
If you want to see the Game,this is it:https://lichess.org/study/HrvyyGKx/kgd4W8bD
Like People say,chess played Perfectly is a draw.
If you want to see the Game,this is it:https://lichess.org/study/HrvyyGKx/kgd4W8bD
Last edited by HasiLover (Aug. 19, 2023 18:03:24)
- HasiLover
- Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
They Played a Rematch,it was a Draw by Repitition
Last edited by HasiLover (Aug. 19, 2023 18:16:03)
- ArnoHu
- Scratcher
1000+ posts
Scratch Chess Engine - Game of Kings
It works again ,the Probem was it made a Move which was lower than the eval,which every move was reset to 0,so if white had an advantage,it couldnt find any moves with an eval lower than 0.Technically its way more complicated than that,but im too lazy to explain.I fixed the Problem by evaluating the Board before it calculates the Moves.
Now i have to make it actually not take every Piece.
Cool, are you going to add castling soon?
- ArnoHu
- Scratcher
1000+ posts
Scratch Chess Engine - Game of Kings
I currently only have pseudo-legal moves, but that shouldn't matter because all legal moves in perft(3) are pseudo-legal.Currently working on move generation in my engine despite the fact that I was trying to get negamax to work. The perft(3) at the starting position is reporting 8881 instead of 8902. I tried expanding so I see which moves are incorrect, but A. I don't have a list of correct move numbers and B. The move numbers aren't adding up.
Maybe a result of pseud-legal but non-legal moves, like pinned pieces moving? GoK does that the whole time, including king captures when not having moved out of check; it's how the deeper search works, the high penalty on a king captures auto-controls that the moves leading there will never be considered, if there are alternatives.
Maybe this helps? https://www.chessprogramming.org/Perft#Divide
- birdracerthree
- Scratcher
500+ posts
Scratch Chess Engine - Game of Kings
Yeah, I did something similar. I have perft(3) correct. I just need to adjust pseudo-legal moves to legal moves to test perft(4+) (and a lot of time)I currently only have pseudo-legal moves, but that shouldn't matter because all legal moves in perft(3) are pseudo-legal.Currently working on move generation in my engine despite the fact that I was trying to get negamax to work. The perft(3) at the starting position is reporting 8881 instead of 8902. I tried expanding so I see which moves are incorrect, but A. I don't have a list of correct move numbers and B. The move numbers aren't adding up.
Maybe a result of pseud-legal but non-legal moves, like pinned pieces moving? GoK does that the whole time, including king captures when not having moved out of check; it's how the deeper search works, the high penalty on a king captures auto-controls that the moves leading there will never be considered, if there are alternatives.
Maybe this helps? https://www.chessprogramming.org/Perft#Divide
- HasiLover
- Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
Sure,first im going to make it look just a small amount deeper and then i will add those Rules.It works again ,the Probem was it made a Move which was lower than the eval,which every move was reset to 0,so if white had an advantage,it couldnt find any moves with an eval lower than 0.Technically its way more complicated than that,but im too lazy to explain.I fixed the Problem by evaluating the Board before it calculates the Moves.
Now i have to make it actually not take every Piece.
Cool, are you going to add castling soon?
- HasiLover_Test
- Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
Hey,im HasiLovers Alt,out of some reason im not authorized on this forum anymore,so i made an Alt.
I wanted to say that my Engine now is able to look 2 Ply Deep
Its really slow though.
I wanted to say that my Engine now is able to look 2 Ply Deep
Its really slow though.
Last edited by HasiLover_Test (Aug. 21, 2023 19:28:07)
- birdracerthree
- Scratcher
500+ posts
Scratch Chess Engine - Game of Kings
Try copying the url of the studio, going into your main account, and paste the url. Or log in and go to your history and pull up the discussion there Hey,im HasiLovers Alt,out of some reason im not authorized on this forum anymore,so i made an Alt.
I wanted to say that my Engine now is able to look 2 Ply Deep
Its really slow though.
- HasiLover
- Scratcher
100+ posts
Scratch Chess Engine - Game of Kings
Thanks it workedTry copying the url of the studio, going into your main account, and paste the url. Or log in and go to your history and pull up the discussion there Hey,im HasiLovers Alt,out of some reason im not authorized on this forum anymore,so i made an Alt.
I wanted to say that my Engine now is able to look 2 Ply Deep
Its really slow though.
- birdracerthree
- Scratcher
500+ posts
Scratch Chess Engine - Game of Kings
No problem, I was having the same issue.Thanks it workedTry copying the url of the studio, going into your main account, and paste the url. Or log in and go to your history and pull up the discussion there Hey,im HasiLovers Alt,out of some reason im not authorized on this forum anymore,so i made an Alt.
I wanted to say that my Engine now is able to look 2 Ply Deep
Its really slow though.
- ArnoHu
- Scratcher
1000+ posts
Scratch Chess Engine - Game of Kings
Hey,im HasiLovers Alt,out of some reason im not authorized on this forum anymore,so i made an Alt.
I wanted to say that my Engine now is able to look 2 Ply Deep
Its really slow though.
Cool, where can we find it?