After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 733708 - “undo” button clickable after the first move
“undo” button clickable after the first move
Status: RESOLVED FIXED
Product: iagno
Classification: Applications
Component: general
git master
Other Linux
: Normal critical
: ---
Assigned To: Michael Catanzaro
iagno-maint
Depends on:
Blocks:
 
 
Reported: 2014-07-25 04:08 UTC by Arnaud B.
Modified: 2014-08-13 01:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make "undo" button unclickable before player's first move. (4.43 KB, patch)
2014-07-29 09:09 UTC, Arnaud B.
none Details | Review
Disallow undo if only computer has moved (3.34 KB, patch)
2014-08-03 16:09 UTC, Michael Catanzaro
committed Details | Review

Description Arnaud B. 2014-07-25 04:08:06 UTC
The “undo” button puts Iagno in a weird state when clicked at the beginning of a computer-plays-first game (after the first computer’s move), or after the first move of a two-players game: it’s neither possible to play, nor to start a new game… (both with the app’menu entry and the “start other” button, they are grayed.)

The logical solution for the computer-plays-first case is to have the “undo” button grayed until the human player’s first move (and when undoing his second move, etc.); for the two-players case, it would probably be good that “undo” just undoes one of the move (the last one, darks’ move OR lights’ move).

/!\ WARNING: the state of the org.gnome.iagno “play-as” gsetting could be changed during the game, don’t rely on it to know the type of the actual game.
Comment 1 Michael Catanzaro 2014-07-25 13:22:49 UTC
If you move it will crash -> critical

I probably won't get to this until late next week, if you want to work on a patch in the meantime.
Comment 2 Michael Catanzaro 2014-07-25 13:29:12 UTC
Backtrace at the downstream report
Comment 3 Arnaud B. 2014-07-29 09:09:10 UTC
Created attachment 281923 [details] [review]
Make "undo" button unclickable before player's first move.

That works, but I don’t know why. /o\ If someone understand the "4" thing…
Comment 4 Michael Catanzaro 2014-08-03 16:09:01 UTC
(In reply to comment #3)
> That works, but I don’t know why. /o\ If someone understand the "4" thing…

Intuitively, you'd think each ply (one player's turn) takes up one space in the undo history, but actually it's each individual tile flip. Since exactly one enemy tile is flipped during the first ply, undo_index will always be 3 at the start of the second ply.
Comment 5 Michael Catanzaro 2014-08-03 16:09:36 UTC
Created attachment 282410 [details] [review]
Disallow undo if only computer has moved

What do you think of this approach? It's pretty similar to what you did.
Comment 6 Michael Catanzaro 2014-08-03 16:11:04 UTC
(In reply to comment #4)
> Since exactly one
> enemy tile is flipped during the first ply, undo_index will always be 3 at the
> start of the second ply.

Well, that's not much of an explanation, but I checked and it's always true. :)
Comment 7 Michael Catanzaro 2014-08-13 01:55:28 UTC
Pushing my patch; thanks for your help on this one!

Attachment 282410 [details] pushed as 9aaac95 - Disallow undo if only computer has moved