Store game moves
Posted: Tue Mar 15, 2016 10:31 am
I just started writing my own chess program (GUI and computer player) which is working fine so far. It is written in java, I know it is not the best choice, but bare with me.
Now my simple problem:
I would like to store the moves made so that they can be displayed in the GUI and also that I can play/move back and forth through the game. What is the best/recommended format to store the game?
1. I could extend my Move class (startPosition, endPosition, movingPiece) to include information on the captured pieces and then store the game as array of the extended move class.
2. Or I could take my original Move class and re-create any position from the starting position.
3. Or I could store a String array of all positions in FEN-notation.
4. Or something else?
Also, how do you store variations? If I want to create some kind of analysis feature.
Now my simple problem:
I would like to store the moves made so that they can be displayed in the GUI and also that I can play/move back and forth through the game. What is the best/recommended format to store the game?
1. I could extend my Move class (startPosition, endPosition, movingPiece) to include information on the captured pieces and then store the game as array of the extended move class.
2. Or I could take my original Move class and re-create any position from the starting position.
3. Or I could store a String array of all positions in FEN-notation.
4. Or something else?
Also, how do you store variations? If I want to create some kind of analysis feature.