2

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 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 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.

  • You might want to look at Chess Programming Wiki. – Pete Becker Oct 14 '15 at 15:27
  • I did something like this for a 400-level computer science course. It isn't hard. You can code it in a pleasurable afternoon. – Tony Ennis Oct 18 '15 at 20:42
0

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. You'll need to learn to read their documentation.

| improve this answer | |
  • 1
    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. – A.Vasil Oct 14 '15 at 8:38
  • 1
    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? – A.Vasil Oct 14 '15 at 8:40
  • 1
    @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. – SmallChess Oct 15 '15 at 0:22
  • 1
    Don't optimize until the code works. – Tony Ennis Oct 18 '15 at 20:43

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.