Skip to content

Correction in chess board evaluation example #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update scratch-chess-v3.md
  • Loading branch information
ArnoHue authored Dec 29, 2021
commit 7f1da7cdece62db53c61dcc8bfa8c1b0fcf8e6e9
2 changes: 1 addition & 1 deletion trainingsanleitungen/scratch/en/scratch-chess-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Our program will play with the black pieces, the user plays white.

The board evaluation is implemented by the custom block "EvaluateBoard". It is important to select the option "Run without screen refresh" (right-click on the custom block header, then "Edit"). Otherwise our program would be too slow.

Our evaluation is composed of the material and position values. Each piece has an assigned value; a king is ranked higher than everything else combined (20,000), as a defeated king means loss by checkmate. Next comes the queen (900), then rooks (500), and so on. The opponent's pieces have a negative value so that all numbers can be added up for the board's material balance. Having one pawn and one tower more than the other side results in a board evaluation of 900 + 500 = 1400. Thus, we can search for moves that promise the best board evaluation, and discard others.
Our evaluation is composed of the material and position values. Each piece has an assigned value; a king is ranked higher than everything else combined (20,000), as a defeated king means loss by checkmate. Next comes the queen (900), then rooks (500), and so on. The opponent's pieces have a negative value so that all numbers can be added up for the board's material balance. Having one pawn and one rook more than the other side results in a board evaluation of 100 + 500 = 600. Thus, we can search for moves that promise the best board evaluation, and discard others.

Piece values are stored in variables named "BlackKing", "WhiteKing", etc. Our current chessboard state is stored in the "Board" list. Board has 64 list entries, one for each square. For calculating the board evaluation, we loop over the list and add up its entries.

Expand Down