Closed wuto-chai closed 3 years ago
I undo the game three times, and it undoes three turns, whereas after I make more moves and then undo, it will only undo one move each time in the demo.
Can we undo 3 times then make a move then undo 3 times?
can we modify other methods in order to achieve undo()?
Undo is only performed when it's human player's turn.
One undo
results the game state back to the last time of human player to play.
In other words, undo
always undo the latest computer's move and then undo the latest human player's move.
Can we undo 3 times then make a move then undo 3 times?
No, consider the program has a memory which only has 3 slots of rounds, any older rounds will be forgotten. If we undo 3 times, all rounds stored in the slots have been consumed. And now we move again, there is only one round stored in the memory. So we can only undo once at this time.
can we modify other methods in order to achieve undo()?
Yes you can modify other methods, but do it as your own risk, since it is enough to only write code at TODO
s.
If you still want to modify other methods, please keep the signature of the methods unchanged, otherwise they will break the tests.
I undo the game three times, and it undoes three turns, whereas after I make more moves and then undo, it will only undo one move each time in the demo.
If I undo more than 3 times (with moves between) The undos after 3 times won't undo the computer move and the human move but will only undo one move. I think this is a bug.
You are correct. I have just fixed it.
would like to specify the question one again lol like ( if computer is player1 and human player2 )
Round1---Computer do a move Round2---Human Action : undo
in this case there is no last human move. so to what extent should we undo?
or human must be the first player so we need not consider it?
For simplicity, just consider human player will always be the first one to move.
If computer player serves as the first player and human as second. Is in round2 (human first round) doing undo same as let computer consider again and perform a new(or may not be new) move in round 1?