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 765997 - Doesn't display prompt window on draw-game after second and so on three-moved repetition
Doesn't display prompt window on draw-game after second and so on three-moved...
Status: RESOLVED FIXED
Product: gnome-chess
Classification: Applications
Component: General
3.16.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-chess-maint
gnome-chess-maint
Depends on:
Blocks:
 
 
Reported: 2016-05-04 17:41 UTC by Mikhail Kasimov
Modified: 2017-01-22 15:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Display claim draw dialog unlimited times per game (2.34 KB, patch)
2016-05-04 19:51 UTC, Michael Catanzaro
committed Details | Review

Description Mikhail Kasimov 2016-05-04 17:41:53 UTC
Hello! Subj.

Steps-to-reproduce
=====
1. Human: white pieces, gnome-chess: black pieces
2. Time-limit: 5 min | 5 min
3. Difficulty: max

1.e4 d5 2. ed Nf6 3. d4 N:d5 4. c4 Nf6 5. Nc3 Nc6 6. d5 Ne5 7. Qd4 Nc6 8. Qd1 Ne5 9. Qd4 Nc6 10.Qd1

and then draw-game prompt window appears. But if user chooses 'Continue', gnome-chess doesn't display draw-game prompt window after the second part of move repetition 'Qd4-Nc6-Qd1-Ne5-Qd1-Nc6'. IMHO, it's bug -- user can have to choose to continue or to finish the game with draw in the second/third/.../N+1 time.

Please, fix it! Thanks.
Comment 1 Michael Catanzaro 2016-05-04 19:49:41 UTC
(In reply to Mikhail Kasimov from comment #0)
> and then draw-game prompt window appears. But if user chooses 'Continue',
> gnome-chess doesn't display draw-game prompt window after the second part of
> move repetition 'Qd4-Nc6-Qd1-Ne5-Qd1-Nc6'. IMHO, it's bug -- user can have
> to choose to continue or to finish the game with draw in the
> second/third/.../N+1 time.

It's debatable how we should handle this... technically the user should be able to choose to draw the game at any time so long as the repetition continues, like you request. I think when I was looking into this a few years ago, I decided that popping up a dialog every move when a draw is available would just be annoying, and if the user doesn't choose to draw when it's first available he probably won't change his mind later on in the sequence. In general, we try to avoid pop-up dialogs in GNOME apps.

But this scenario is so rare; in retrospect, the value of better matching the rules of chess probably outweighs the annoyance of opening the dialog again and again. In the case of threefold repetition, if you keep moving into a repetition state, you deserve to get the dialog again; just don't keep repeating the same move if you want to avoid that.

In the case of the fifty-move rule, it's less clear that presenting the dialog is useful, though. I think this is probably why I decided to present the dialog only once per game. But in this case, you're more likely to change your decision as to whether you want to draw or not, so arguably here is where the dialog is even more important.

We used to have a claim draw menu item, which you had to press to claim a draw under these rules. I don't think we want to bring that back, as there's no room for it in the UI.
Comment 2 Michael Catanzaro 2016-05-04 19:51:39 UTC
Created attachment 327316 [details] [review]
Display claim draw dialog unlimited times per game

Let's adhere to the rules of chess, and give the player a chance to
claim a draw whenever entitled to a draw.

Disadvantage: in draw scenarios, this causes a pop-up dialog to appear
on every turn. We might want to think about this more before committing this patch.

Another disadvantage: when closing and reopening the game while in a position eligible for a draw, this causes the dialog to appear before the window is displayed (because game_turn_cb is invoked before the window is displayed). I think we need to fix this before committing this patch.
Comment 3 Michael Catanzaro 2016-05-04 19:55:13 UTC
(In reply to Michael Catanzaro from comment #2) 
> Another disadvantage: when closing and reopening the game while in a
> position eligible for a draw, this causes the dialog to appear before the
> window is displayed (because game_turn_cb is invoked before the window is
> displayed). I think we need to fix this before committing this patch.

Just kidding, this is a preexisting bug, not anything that should block this issue. Bug #766004.
Comment 4 Michael Catanzaro 2016-05-04 20:23:03 UTC
FYI: I just branched gnome-3-20 with a GTK+ 3.20 fix, so we can commit this change to master but not gnome-3-20.
Comment 5 Mikhail Kasimov 2016-05-04 20:23:59 UTC
I took a pause to test algo on another chessgames. E.g. AI Factory Chess (Android) doesn't flirt with user -- if three-moved rule is triggered, user gets "Draw game" window with single button "OK". No chance to continue current game. If user wants to continue current game, he has to take back the last move (by the way - we can add checkbox 'Forbid taking move back' to Settings section. It's a small additional feature request) and to continue game with another move.

Possibly, we also do not need to prompt user on draw-game to continue game, only if program resigns. What d'you think about this?
Comment 6 Michael Catanzaro 2016-05-04 20:42:55 UTC
(In reply to Mikhail Kasimov from comment #5)
> (by the way - we can add checkbox 'Forbid taking move back' to
> Settings section. It's a small additional feature request)

Seems fine to me. Feel free to file a different bug for this.

> Possibly, we also do not need to prompt user on draw-game to continue game,
> only if program resigns. What d'you think about this?

I dunno; it's reasonable to draw the game immediately, but there's value in following the rules precisely. See also bug #766005.
Comment 7 Mikhail Kasimov 2016-05-04 20:52:54 UTC
see 766006 and 766007
Comment 8 Michael Catanzaro 2017-01-22 15:02:31 UTC
Attachment 327316 [details] pushed as b7acfb4 - Display claim draw dialog unlimited times per game