Page 1 of 1

Continuing a saved and loaded game

PostPosted: 18 Jun 2009, 22:10
by ueberdu
I downloaded Winboard source some time ago, modified it to my needs then (I ripped off many parts...).
Now I decided to bring back some functionality again, namely loading and saving games.
I dont know, how loading and saving is actually meant, but what I would like to have is:
Save an ongoing game, load it later and simply continue playing.
The problem I encountered is that I can not continue the game, as obviously the moves are made on the board, but not in the engine.
I figured out that I might tell the engine a certain position by "position moves ...", but after this the engine immediately starts thinking.
This should not be the case (at least not, if its my turn to move).
Any ideas how to achieve (programmatically) what I like?

ueberdu.

Re: Continuing a saved and loaded game

PostPosted: 19 Jun 2009, 00:03
by Dann Corbit
Take the Fen for the last position in the saved game.
Do a SETBOARD for that Fen for both engines (along with other relevant data like side to move, etc.).
Restart the game.

There will be a small loss because the hashtables have lost their data, but it will be about the same loss for both sides.

Re: Continuing a saved and loaded game

PostPosted: 19 Jun 2009, 19:13
by ueberdu
Thanks for the answer.
This nearly works, but still I do not get exactly what I want.
I think that now the engine is in the right board state, but not prepared to play:
"Force" is send by winboard to the engine to allow the moves to be made.
If its whites turn and the engine plays white, I can send "go" to the engine and then I have it.
But if its whites turn and the engine plays back, I can make a move, but the engine will not react to it (is still in "force").
How can I make the engine also react correctly in the second situation (here a "go" would mean that the engine computes the next white move, which would be wrong).

ueberdu.

Re: Continuing a saved and loaded game

PostPosted: 19 Jun 2009, 19:49
by ueberdu
Update:

I finally made it!
Actually after loading a position (FEN) there is no information what color the engine plays/played anyway.
So just proceeding the "normal" way after having loaded a position from FEN it works:
If its whites turn in the position and I am white, well then I just make the move and set "Machine Plays Black".
Then the engine starts thinking for black.
If I am black in the position, well then I choose "Machine Plays White" and the machine starts to think for a white move.
And similiar if its blacks turn in the loaded position...

ueberdu.