Answers.Body: <p>It's possible (statically) but you may need to do some works. Let's take a look at Stockfish.</p>
  
  <p>In the terminal, start Stockfish and type <code>eval</code>.</p>
  
  <p><a href="https://i.sstatic.net/NYjKu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NYjKu.png" alt="enter image description here"></a></p>
  
  <p>Stockfish knows about your passed pawns, king safety, good knights etc. Your job is to pull it out from the source code.</p>
  
  <p>Let's study Stockfish's evaluation. The source file is at: <a href="https://github.com/official-stockfish/Stockfish/blob/master/src/evaluate.cpp" rel="nofollow noreferrer">https://github.com/official-stockfish/Stockfish/blob/master/src/evaluate.cpp</a></p>
  
  <p>Let's try two examples: <strong>bad knight</strong> and <strong>passed pawn</strong>.</p>
  
  <ol>
  <li><strong>Bad knight</strong></li>
  </ol>
  
  <p>The line:</p>
  
  <pre><code>pos.attacks_from&lt;Pt&gt;(s)
  </code></pre>
  
  <p>gives you the attack bitboard for your knight. The PST table for the knight is in <strong>psqt.cpp</strong>.</p>
  
  <pre><code>{ S(-144, -98), S(-96,-82), S(-80,-46), S(-73,-14) },
  { S( -83, -69), S(-43,-54), S(-21,-17), S(-10,  9) },
  { S( -71, -50), S(-22,-39), S(  0, -7), S(  9, 28) },
  { S( -25, -41), S( 18,-25), S( 43,  6), S( 47, 38) },
  { S( -26, -46), S( 16,-25), S( 38,  3), S( 50, 40) },
  { S( -11, -54), S( 37,-38), S( 56, -7), S( 65, 27) },
  { S( -62, -65), S(-17,-50), S(  5,-24), S( 14, 13) },
  { S(-194,-109), S(-66,-89), S(-42,-50), S(-29,-13) }
  </code></pre>
  
  <p>Do you see -29 for the h1 square? </p>
  
  <ol start="2">
  <li><strong>Passed pawn</strong></li>
  </ol>
  
  <p>The line:</p>
  
  <pre><code>ei.pe-&gt;passed_pawns(Us)
  </code></pre>
  
  <p>gives you passed pawn information for a colour.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T02:30:18.257Z
Answers.Text: Could you elaborate on the "bad knight" part, specifically what those tables mean? I don't know the details of Stockfish's evaluation, but would imagine that it uses rather crude/fast algorithms to estimate things like piece activity. Even if it gets the piece activity part wrong for one piece that's not a big issue as this is only one tiny part of the evaluation. However if you want to look at only one position, you'd have more time and could invent slower/more precise algorithms to evaluate features like good/bad knight!?
Answers.UserDisplayName: user1583209
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T03:12:07.893Z
Answers.Text: @user1583209 https://chessprogramming.wikispaces.com/Piece-Square+tables for PST
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T08:58:59.527Z
Answers.Text: Not sure I understand what you mean by "statistically" (also you might need to edit your answer where it says "statically"). That is statistics over what data?
Answers.UserDisplayName: user1583209
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T08:59:48.317Z
Answers.Text: Sorry I meant statically
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T09:25:32.600Z
Answers.Text: How about positions, where a piece is currently not active, but will be so soon (unavoidably)? For example a rook which can go onto an open file. I understand that in a static stockfish evaluation this would not count as a good rook, while a human might consider it a good piece.
Answers.UserDisplayName: user1583209
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T09:26:14.507Z
Answers.Text: @user1583209 I think that'd be too involved. That is a dynamic feature.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T09:27:00.430Z
Answers.Text: @user1583209 In my answer I'd argue it's easy to do it in a static way. The old Chessmaster did exactly that. But a more dynamic smarter way is not trivial.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T01:35:06.283Z
Answers.LastActivityDate: 2017-03-20T01:35:06.283Z
Answers.UserDisplayName: SmallChess
Body: <p>is there a program available that will take a position as input and output the features in that position such as: bad knight on H3, good bishop on g2, knight outpost on E5, passed pawn on c6, etc.  It would be ideal if it took FEN string and operated from the command line? </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-18T01:03:31.273Z
Comments.Text: That would be interesting. Objective things like passed pawns, isolated pawns, etc would be easy to program and are for instance implemented in database programs like scid. However I would imagine that obtaining subjective features like "good bishop" automatically would be very very difficult (or prone to many false positives).
Comments.UserDisplayName: user1583209
Tags: <engines><positional-play><computer-chess>
Title: program to output features in a position
ThreadText: # program to output features in a position
  
  (Asked by: username_0 on 2017-03-18)
  
  is there a program available that will take a position as input and output the features in that position such as: bad knight on H3, good bishop on g2, knight outpost on E5, passed pawn on c6, etc. It would be ideal if it took FEN string and operated from the command line?
  
  **Tags:** engines, positional-play, computer-chess
  
  > **Comments:**
  > **username_1**: That would be interesting. Objective things like passed pawns, isolated pawns, etc would be easy to program and are for instance implemented in database programs like scid. However I would imagine that obtaining subjective features like "good bishop" automatically would be very very difficult (or prone to many false positives).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-03-20. Score: 0 | Accepted answer
  
  It's possible (statically) but you may need to do some works. Let's take a look at Stockfish.
  
  In the terminal, start Stockfish and type `eval`.
  
  [![enter image description here](https://i.sstatic.net/NYjKu.png)](https://i.sstatic.net/NYjKu.png)
  
  Stockfish knows about your passed pawns, king safety, good knights etc. Your job is to pull it out from the source code.
  
  Let's study Stockfish's evaluation. The source file is at: <https://github.com/official-stockfish/Stockfish/blob/master/src/evaluate.cpp>
  
  Let's try two examples: **bad knight** and **passed pawn**.
  
  1. **Bad knight**
  
  The line:
  
  ```
  pos.attacks_from<Pt>(s)
  
  ```
  
  gives you the attack bitboard for your knight. The PST table for the knight is in **psqt.cpp**.
  
  ```
  { S(-144, -98), S(-96,-82), S(-80,-46), S(-73,-14) },
  { S( -83, -69), S(-43,-54), S(-21,-17), S(-10,  9) },
  { S( -71, -50), S(-22,-39), S(  0, -7), S(  9, 28) },
  { S( -25, -41), S( 18,-25), S( 43,  6), S( 47, 38) },
  { S( -26, -46), S( 16,-25), S( 38,  3), S( 50, 40) },
  { S( -11, -54), S( 37,-38), S( 56, -7), S( 65, 27) },
  { S( -62, -65), S(-17,-50), S(  5,-24), S( 14, 13) },
  { S(-194,-109), S(-66,-89), S(-42,-50), S(-29,-13) }
  
  ```
  
  Do you see -29 for the h1 square?
  
  2. **Passed pawn**
  
  The line:
  
  ```
  ei.pe->passed_pawns(Us)
  
  ```
  
  gives you passed pawn information for a colour.
  
  > **Comments:**
  > **username_1**: Could you elaborate on the "bad knight" part, specifically what those tables mean? I don't know the details of Stockfish's evaluation, but would imagine that it uses rather crude/fast algorithms to estimate things like piece activity. Even if it gets the piece activity part wrong for one piece that's not a big issue as this is only one tiny part of the evaluation. However if you want to look at only one position, you'd have more time and could invent slower/more precise algorithms to evaluate features like good/bad knight!?  
  > **username_2**: @username_1 https://chessprogramming.wikispaces.com/Piece-Square+tables for PST  
  > **username_1**: Not sure I understand what you mean by "statistically" (also you might need to edit your answer where it says "statically"). That is statistics over what data?  
  > **username_2**: Sorry I meant statically  
  > **username_1**: How about positions, where a piece is currently not active, but will be so soon (unavoidably)? For example a rook which can go onto an open file. I understand that in a static stockfish evaluation this would not count as a good rook, while a human might consider it a good piece.  
  > **username_2**: @username_1 I think that'd be too involved. That is a dynamic feature.  
  > **username_2**: @username_1 In my answer I'd argue it's easy to do it in a static way. The old Chessmaster did exactly that. But a more dynamic smarter way is not trivial.  
  
  ---
  
  