I took the easy route for unmaking moves. What I did was simply adding a prevPos property to the move class which holds a FEN-string with the previous position.
In short if the move is e2-e4 in the starting position, the Move-object describing the move would hold a FEN-string with the starting position in prevPos.
Then when we want to unmake the move, we simply use the inputFEN()-method with the FEN located in the Move-object.
When using this way of taking back moves, we will have to be very careful to do the takebacks in the right order. If we try to unmake a move that was not just played on the board, we would jump to some arbitrary position when that move was made. Of course this will be the case even with another setup, since trying to take back a move that was not just played on the board could have unexpected effects.
I have a feeling this will have a considerable effect on the speed of the program later on, but atleast it gets the job done for now. Expect it to change when we start to tweak the performance.
mediocre(dl4)
Edits:
2006-12-18 - Added a few lines about importance of taking back moves in the right order
No comments:
Post a Comment