Answers.Body: <p>@Fred_Knight Well done.</p>
  
  <p>I'm addressing OP's comment to Fred.</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>Normally, engine authors determine the values by trial-and-error or/and parameter tuning. But, not here!</p>
  
  <p>Have you notice the values are <strong>an increment of 0.5</strong>? 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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-09T10:48:51.720Z
Answers.Text: 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.
Answers.UserDisplayName: ferit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-09T11:45:36.790Z
Answers.Text: @ferit your point? The table values were obviously man-made for blogging.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-09T11:46:36.037Z
Answers.Text: My point is clear. And how many parameters are there?
Answers.UserDisplayName: ferit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-09T11:47:13.620Z
Answers.Text: @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?
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-09T11:51:33.720Z
Answers.Text: That makes sense. There are infinite number of rational numbers inside an interval. Giving an increment makes it finite, thus searchable.
Answers.UserDisplayName: ferit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-09T11:52:29.737Z
Answers.Text: @ferit Ok, if you believe the author used an algorithm programmatically coming up with those values, please write an answer. I'll insist it was man-made for educational.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-09T11:56:22.477Z
Answers.Text: I was lazy so I wanted to improve your answer instead :)
Answers.UserDisplayName: ferit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-09T05:41:03.307Z
Answers.LastActivityDate: 2018-07-09T05:41:03.307Z
Answers.UserDisplayName: SmallChess
Answers.Body: <p>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. </p>
  
  <p><strong>Extra table talk</strong>:  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.</p>
  
  <p><strong>Chess based table</strong>:  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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-08T10:57:53.580Z
Answers.Text: 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 ?
Answers.UserDisplayName: Absolute Idiot
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-08T12:11:35.120Z
Answers.Text: https://chessprogramming.wikispaces.com/Simplified%20evaluation%20function 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.
Answers.UserDisplayName: Fred Knight
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-06T12:48:52.990Z
Answers.Text: @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 https://github.com/AndyGrant/Ethereal/tree/master/src here and https://www.chessprogramming.org/Texel%27s_Tuning_Method)
Answers.UserDisplayName: AspectOfTheNoob
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-07T19:27:04.400Z
Answers.LastActivityDate: 2018-07-07T19:27:04.400Z
Answers.UserDisplayName: Fred Knight
Body: <p>I wanted to know how are the <strong>values for piece square table</strong> are determined for simplified evaluation function in <strong>chess A.I engines</strong> </p>
  
  <p>For example
  <a href="https://i.sstatic.net/hxGdi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hxGdi.png" alt="enter image description here"></a></p>
  
  <p>Source :</p>
  
  <p><a href="https://medium.freecodecamp.org/simple-chess-ai-step-by-step-1d55a9266977" rel="nofollow noreferrer">https://medium.freecodecamp.org/simple-chess-ai-step-by-step-1d55a9266977</a></p>
  
Tags: <engines><computer-chess>
Title: In chess engines (A.I) how are the values for Piece-Square Tables for simplified evlaution function determined?
ThreadText: # In chess engines (A.I) how are the values for Piece-Square Tables for simplified evlaution function determined?
  
  (Asked by: username_0 on 2018-07-07)
  
  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
  [![enter image description here](https://i.sstatic.net/hxGdi.png)](https://i.sstatic.net/hxGdi.png)
  
  Source :
  
  <https://medium.freecodecamp.org/simple-chess-ai-step-by-step-1d55a9266977>
  
  **Tags:** engines, computer-chess
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-07-09. Score: 1
  
  @username_3\_Knight Well done.
  
  I'm addressing OP's comment to username_3.
  
  > 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.
  
  > **Comments:**
  > **username_2**: 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.  
  > **username_1**: @username_2 your point? The table values were obviously man-made for blogging.  
  > **username_2**: My point is clear. And how many parameters are there?  
  > **username_1**: @username_2 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?  
  > **username_2**: That makes sense. There are infinite number of rational numbers inside an interval. Giving an increment makes it finite, thus searchable.  
  > **username_1**: @username_2 Ok, if you believe the author used an algorithm programmatically coming up with those values, please write an answer. I'll insist it was man-made for educational.  
  > **username_2**: I was lazy so I wanted to improve your answer instead :)  
  
  ---
  
  ### Answer by username_3 on 2018-07-07. Score: 1
  
  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 username_3 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.
  
  > **Comments:**
  > **username_0**: 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 ?  
  > **username_3**: https://chessprogramming.wikispaces.com/Simplified%20evaluation%20function 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.  
  > **username_4**: @username_0 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 https://github.com/AndyGrant/Ethereal/tree/master/src here and https://www.chessprogramming.org/Texel%27s_Tuning_Method)  
  
  ---
  
  