Answers.Body: <p>While I certainly don't know every Java library for chess, I'd be surprised to see a library designed to extract features like what you describe. There shouldn't be one because nobody else needs it.</p>
  
  <p>Fortunately, everything you said is implemented and more or less there, but you'll have to do some works. You should consider to use an open-source project that has bitboard implemented (such as Droidfish or any Java engine uses bitboards). You'll need to learn how to use bitboards, but you'll find it useful to do what you want to do.</p>
  
  <p>For example, you can get total mobility by masking the attacking pieces with the opponent pieces, something like:</p>
  
  <pre><code>(squares attacked by my pieces on an empty board) &amp; (their pieces)
  </code></pre>
  
  <p>As another example, we can get board control by:</p>
  
  <pre><code>(squares attacked by my pieces on an empty board) &amp; !(squares attacked by their pieces on an empty board)
  </code></pre>
  
  <p>For the documentation on Chesspresso, I doubt there is anything better than it's <a href="http://www.chesspresso.org/javadoc/index.html" rel="nofollow">Java docs</a>. You'll need to learn to read their documentation.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-14T08:38:34.903Z
Answers.Text: First of all thank you for your answer.
  I started reading the Javadoc of Chesspresso.I am hoping to find all i need there.
  As for the chessboard representation i was planning on using a 12x12 representation of the chessboard combining it with two 16x1 arrays for the pieces of each side.
  The 12x12 will be a class **Square** array.This class will contain all the information i need such as which piece is in it, if its empty,if it is out of bounds etc.
  The 16x1 arrays will be of class **Piece** and contain information about  each piece such as if it is still in the game,its position,its type etc.
Answers.UserDisplayName: Agisilaos Vasileiadis
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-14T08:40:42.140Z
Answers.Text: It is possible although to try to use only the two 16x1 arrays to represent the chessboard while reducing the cost.
  I am not familiar with bitboards.Do you believe they are better fit for my project?
Answers.UserDisplayName: Agisilaos Vasileiadis
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-15T00:22:05.567Z
Answers.Text: @A.Vasil I don't see a reason why an array representation can't be used. Bitboards is just another way of doing the same thing. Choose whatever method you're comfortable with.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-18T20:43:47.207Z
Answers.Text: Don't optimize until the code works.
Answers.UserDisplayName: Tony Ennis
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-13T23:38:51.393Z
Answers.LastActivityDate: 2015-10-13T23:38:51.393Z
Answers.UserDisplayName: SmallChess
Body: <p>So i am implementing an intelligent chess agent with the use of reinforcement learning.I intend to use Java.</p>
  
  <p>After reading the <a href="http://www.phil.uu.nl/preprints/ckiscripties/SCRIPTIES/029_mannen.pdf" rel="nofollow">master thesis of H.Mannen</a> i decided to use some of the features listed on Appendix B of his master that can be found on page 67.</p>
  
  <p><em>Edit- Description of the features:</em></p>
  
  <p>-<strong>Board control</strong> : amount of empty squares controlled by a side</p>
  
  <p>-<strong>Connectivity</strong> : amount of connectedness between the pieces of a side</p>
  
  <p>-<strong>King’s distance to center</strong> amount of squares a king is separated from one of the center squares e4, d4, e5, d5</p>
  
  <p>-<strong>Total mobility</strong> : total sum of squares reachable by a side</p>
  
  <p>-<strong>Center control</strong> : amount of pawns occupying the squares e4, d4, e5, d5.</p>
  
  <p>-<strong>Isolated pawns</strong> : amount of pawns without a pawn of its own side on an adjacent line.</p>
  
  <p>-<strong>Doubled pawns</strong> : amount of pawns, greater than 1, on 1 line. </p>
  
  <p>-<strong>Passed pawns</strong> : amount of pawns without an enemy pawn ahead of it on the same or an adjacent line.</p>
  
  <p>-<strong>Pawn forks</strong> : amount of pawns which attack two superior pieces.</p>
  
  <p>Due to the fact that my project is focused on the AI part of the chess agent i would like to use some preexisting open source Java libraries or functions that automate the proccess of extracting these features from the chessboard.</p>
  
  <p>After searching, the only thing i found was <a href="http://www.chesspresso.org/" rel="nofollow">Chesspresso</a> but it comes with no tutorial and i was unable to find one. So i have two questions:</p>
  
  <p>-Do you know any good tutorials for Chesspresso?</p>
  
  <p>-Are aware of any Java open source library that will help me extract the features i want from the chessboard so i can reduce the programming cost of the project?</p>
  
  <p>Thanks in advance.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-14T15:27:59.147Z
Comments.Text: You might want to look at [Chess Programming Wiki](http://chessprogramming.wikispaces.com).
Comments.UserDisplayName: Pete Becker
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-18T20:42:58.040Z
Comments.Text: I did something like this for a 400-level computer science course. It isn't hard. You can code it in a pleasurable afternoon.
Comments.UserDisplayName: Tony Ennis
Tags: <engines><software><pgn><evaluation><chessbase>
Title: Extracting features from chessboard
ThreadText: # Extracting features from chessboard
  
  (Asked by: username_0 on 2015-10-13)
  
  So i am implementing an intelligent chess agent with the use of reinforcement learning.I intend to use Java.
  
  After reading the [master thesis of H.Mannen](http://www.phil.uu.nl/preprints/ckiscripties/SCRIPTIES/029_mannen.pdf) i decided to use some of the features listed on Appendix B of his master that can be found on page 67.
  
  *Edit- Description of the features:*
  
  -**Board control** : amount of empty squares controlled by a side
  
  -**Connectivity** : amount of connectedness between the pieces of a side
  
  -**King’s distance to center** amount of squares a king is separated from one of the center squares e4, d4, e5, d5
  
  -**Total mobility** : total sum of squares reachable by a side
  
  -**Center control** : amount of pawns occupying the squares e4, d4, e5, d5.
  
  -**Isolated pawns** : amount of pawns without a pawn of its own side on an adjacent line.
  
  -**Doubled pawns** : amount of pawns, greater than 1, on 1 line.
  
  -**Passed pawns** : amount of pawns without an enemy pawn ahead of it on the same or an adjacent line.
  
  -**Pawn forks** : amount of pawns which attack two superior pieces.
  
  Due to the fact that my project is focused on the AI part of the chess agent i would like to use some preexisting open source Java libraries or functions that automate the proccess of extracting these features from the chessboard.
  
  After searching, the only thing i found was [Chesspresso](http://www.chesspresso.org/) but it comes with no tutorial and i was unable to find one. So i have two questions:
  
  -Do you know any good tutorials for Chesspresso?
  
  -Are aware of any Java open source library that will help me extract the features i want from the chessboard so i can reduce the programming cost of the project?
  
  Thanks in advance.
  
  **Tags:** engines, software, pgn, evaluation, chessbase
  
  > **Comments:**
  > **username_1**: You might want to look at [Chess Programming Wiki](http://chessprogramming.wikispaces.com).  
  > **username_2**: I did something like this for a 400-level computer science course. It isn't hard. You can code it in a pleasurable afternoon.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2015-10-13. Score: 0 | Accepted answer
  
  While I certainly don't know every Java library for chess, I'd be surprised to see a library designed to extract features like what you describe. There shouldn't be one because nobody else needs it.
  
  Fortunately, everything you said is implemented and more or less there, but you'll have to do some works. You should consider to use an open-source project that has bitboard implemented (such as Droidfish or any Java engine uses bitboards). You'll need to learn how to use bitboards, but you'll find it useful to do what you want to do.
  
  For example, you can get total mobility by masking the attacking pieces with the opponent pieces, something like:
  
  ```
  (squares attacked by my pieces on an empty board) & (their pieces)
  
  ```
  
  As another example, we can get board control by:
  
  ```
  (squares attacked by my pieces on an empty board) & !(squares attacked by their pieces on an empty board)
  
  ```
  
  For the documentation on Chesspresso, I doubt there is anything better than it's [Java docs](http://www.chesspresso.org/javadoc/index.html). You'll need to learn to read their documentation.
  
  > **Comments:**
  > **username_0**: First of all thank you for your answer. I started reading the Javadoc of Chesspresso.I am hoping to find all i need there. As for the chessboard representation i was planning on using a 12x12 representation of the chessboard combining it with two 16x1 arrays for the pieces of each side. The 12x12 will be a class **Square** array.This class will contain all the information i need such as which piece is in it, if its empty,if it is out of bounds etc. The 16x1 arrays will be of class **Piece** and contain information about  each piece such as if it is still in the game,its position,its type etc.  
  > **username_0**: It is possible although to try to use only the two 16x1 arrays to represent the chessboard while reducing the cost. I am not familiar with bitboards.Do you believe they are better fit for my project?  
  > **username_3**: @A.Vasil I don't see a reason why an array representation can't be used. Bitboards is just another way of doing the same thing. Choose whatever method you're comfortable with.  
  > **username_2**: Don't optimize until the code works.  
  
  ---
  
  