CastleLab / COMP3021-2020Fall-PA3-Student-Version

HKUST - COMP3021 - 2020Fall - Programming Assignment 3 - Student Version
https://course.cse.ust.hk/comp3021/
Apache License 2.0
1 stars 0 forks source link

About Undo operation #26

Closed wuto-chai closed 3 years ago

wuto-chai commented 3 years ago

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?

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

zcmiyano commented 3 years ago

Can we undo 3 times then make a move then undo 3 times?

wuto-chai commented 3 years ago

can we modify other methods in order to achieve undo()?

Troublor commented 3 years ago

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.

Troublor commented 3 years ago

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.

Troublor commented 3 years ago

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

If you still want to modify other methods, please keep the signature of the methods unchanged, otherwise they will break the tests.

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

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.

Troublor commented 3 years ago

You are correct. I have just fixed it.

wuto-chai commented 3 years ago

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?

Troublor commented 3 years ago

For simplicity, just consider human player will always be the first one to move.