1

Looking into a source code of a chess engine, I noticed matrices that represent position of some pieces.

knightPos = [
   -200, -100, -50, -50, -50, -50, -100, -200,
   -100, 0, 0, 0, 0, 0, 0, -100,
   -50, 0, 60, 60, 60, 60, 0, -50,
   -50, 0, 30, 60, 60, 30, 0, -50,
   -50, 0, 30, 60, 60, 30, 0, -50,
   -50, 0, 30, 30, 30, 30, 0, -50,
   -100, 0, 0, 0, 0, 0, 0, -100,
   -200, -50, -25, -25, -25, -25, -50, -200
]

There are more matrices like this there (also I found the same matrices in other chess engine). It looks like they decode the quality of the piece based on it's position.

Is there any place, where I can read about it, how it is used and how people came up with these numbers?

  • Your guess is correct; the engine is trying to give an evaluation bonus for knights that are centralized (especially ones in the opponent's half of the board, restricting his movement) and penalizing ones on the sides ("a knight on the rim is dim"). This numbers are usually just arrived at heuristically. – dfan Mar 28 '15 at 0:32
1

This is a very common data-structure in chess engine - Piece-Square-Tables.

Refer to https://chessprogramming.wikispaces.com/Piece-Square+Tables for more details.

Basically, it gives a score for a piece on a particular score and it's almost always symmetry (white and black have the same score but flipped).

For example, if I modified the score for knight in the table on d4 to positive infinity. The engine will believe placing a knight is very important, it'll sacrifice it's queen, rooks, bishops just to permanently position a knight on the d4 square.

The values are usually determined by trials-and-errors. Stronger engines such as Stockfish learn the values by playing hundreds or thousands of games, this is known as parameter calibration or automatic tuning.

Refer to https://chessprogramming.wikispaces.com/Automated+Tuning for more details.

CLOP and Texel are two common tuning methods.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.