# In chess engines (A.I) how are the values for Piece-Square Tables for simplified evlaution function determined?

I wanted to know how are the values for piece square table are determined for simplified evaluation function in chess A.I engines

For example

Source :

https://medium.freecodecamp.org/simple-chess-ai-step-by-step-1d55a9266977

They're mostly based on mobility, and have been modified by repeated test cases. Knights have more squares available when on the center 16 squares(8) than in the corner(2), therefore the central square have a higher value. After the computer plays many games, these values are adjusted based upon how well the pieces actually preformed on the various squares. Beginners are taught that the more centralized piece is better placed, and the computer is taught this basic rules via these tables.

Extra table talk: King Tropism is a table, usually written dynamically, that indicates king safety. It adds up the score of the squares around the king based upon how many times their attacked and defended.

Chess based table: The table being static is a poor valuation tool. The b5 square is normally a good place for the bishop. However, when there's no knight on c6, the bishop is useless on b5. In the French defense, where there's pawns on d5 and e6, the bishop is less than useless as it gives black both a target and the opportunity to exchange his bad bishop.

• How are the values determined ? What method or algorithm is used to determine the values for Piece square table ? Is it some numbers based on our assumptions for a particular piece ? Commented Jul 8, 2018 at 10:57
• chessprogramming.wikispaces.com/… explains it better. Larry Kaufman was the one who tweaked these numbers based on statistics from games. The simple tables were just guesses based on chess pattern recognition. Commented Jul 8, 2018 at 12:11
• @AbsoluteIdiot The 2 modern approaches used are SPSA tuning and a modern variant of texel-tuning. The former is based on playing hundreds of thousands to millions of games to find the optimal values for certain hyperparameters in the search and evaluation of an engine, and the latter uses gradient descent with positions labeled as Win, Draw, or Loss, and applies a logistic regression based on a sigmoid of the evaluation function(You can read more about texel tuning github.com/AndyGrant/Ethereal/tree/master/src here and chessprogramming.org/Texel%27s_Tuning_Method) Commented Oct 6, 2023 at 12:48

@Fred_Knight Well done.

I'm addressing OP's comment to Fred.

How are the values determined ? What method or algorithm is used to determine the values for Piece square table ? Is it some numbers based on our assumptions for a particular piece

Normally, engine authors determine the values by trial-and-error or/and parameter tuning. But, not here!

Have you notice the values are an increment of 0.5? They are just guesses based on simple chess understanding. The blog writer was typing in 0.5,1.0,1.5,2.0,-0.5... into the table, for educational purposes.

• There are optimization algorithms for finding optimum values programmatically. Assuming they have 100 metrics for evaluation, finding an optimum point manually in a 100-Dimension space is practically impossible. Commented Jul 9, 2018 at 10:48
• @ferit your point? The table values were obviously man-made for blogging. Commented Jul 9, 2018 at 11:45
• My point is clear. And how many parameters are there? Commented Jul 9, 2018 at 11:46
• @ferit Many. Do you think the author used a program to come up 0.5,1.0,1.5,0,-0.5? Everything was a perfect increment of 0.5? No floating errors? Commented Jul 9, 2018 at 11:47
• That makes sense. There are infinite number of rational numbers inside an interval. Giving an increment makes it finite, thus searchable. Commented Jul 9, 2018 at 11:51