bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnubg] Tutor mode patches for gnubg


From: Jim Segrave
Subject: [Bug-gnubg] Tutor mode patches for gnubg
Date: Tue, 23 Jul 2002 21:29:50 +0200
User-agent: Mutt/1.2.5i

Well - I've got something that seems to work, with one minor
niggle. Enclosed patch is against the CVS version of 23 July at about
17:00 GMT.

What it is:

I've added an option 'Tutor' which sets a internal flag fTutor. It
appears as a checkbox in the Settings/Options/Automatic page, although
for some reason, clicking it in the Settings menu does not 'stick',
whereas manually entering 'set tutor on' does set a sticky option. The
menu layout changed drastically from the version I was developing on
(from about July 4) did do the right thing. I tried to use the
AutoRoll option as a model, but it doesn't seem to work. Advice would
be appreciated

When it's enabled gnubg checks for the skill level of the current move if
the player is human. If the skill level is SKILL_DOUBTFUL or worse, gnubg
brings up a popup window with a warning:

You may be about to make a doubtful/bad/very bad play. Are you sure?

The window has three buttons: 

Play Anyway - the move continues
Rethink     - the player can change his move. If it's a chequer
              move, the move still shows on the game board, ^Z or the 
              like is needed to actually change it. For text mode,
                          this is irrelevant.

End Tutor Mode - resets the Tutor flag and does a 'Play Anyway'. This
              is mostly to avoid the annoyance of forgetting you had
              tutor mode set on and having to go back to the settings
              menu to cancel it.

I have added code to evaluate the skill level of a move at the
following points:

1) When a player gives a roll command - a check is done to see if a
   double would be a good idea.

2) When a player doubles/redoubles/beavers etc.

3) When a player takes/passes a double

4) When a player completes a move - either the end of a text entry
   line or clicking the dice after a move in graphical mode.

I have not inserted code to check resignations or accepting
resignations, although it should be easy.

I originally included a gdk_beep as well, but removed it, because, as a
matter of personal taste, I dislike noisy programs.

Evaluations are done using the same code as hint, so a user who has a
significant difference between their analysis and evaluation settings
may get warnings which don't show up in a post-mortem or not get
warnings for play which is flagged in post-mortems.

No attempt is made to save any evaluation results, so if AutoAnalyse
is also set, I believe each move would be fully evaluated twice. 

Poosible bugs:

The code is, needless to say, only lightly tested, although my level
of play gives it a fair workout. 

I've not done anything extra to deal with issues of events occurring
while an analysis is running, I'm assuming that that's already dealt
with (and if not, then the fix belongs at a lower level than this,
since other things, like auto-analysis and gnubg choosing it's next
move will be similarly vulnerable).


A bit of rationale:

I think, after a few days of playing with it, that it's pretty much
what I'd want - it tells me I'm doing something wrong, without
specifying what it is (although in the case of cube action, it's
pretty obvious). This is different than choosing a move and then using
the hint command to see where it rates (at least in my view).

Possible changes or enhancements:

I spent a while toying with the idea of having a permanent window for
this, rather than a pop-up which only comes up on errors. My thinking
was that the window would be normally empty and inactive, but would
get a message and grab events when the user was about to do something
dubious. It didn't seem to feel right to me, but others may disagree. 

Another possibility, again less intrusive than a pop-up window, would
be to add a region to the board itself for the response buttons (in
the same way that the take/pass buttons only appear when the player is
doubled). This might be better, but a) I did not fancy playing with
the code in gtkboard.c and b) I admit that I'm still not clear how the
board makes the buttons appear and disappear (gtk_widget_hide () of
the button box is not it, the board would be re-sizing if you do
that).

Perhaps it should allow the user to select the level at which it
issues warnings (so that it wouldn't interrupt play for a 'doubtful
move', only a 'bad' or 'very bad' play.

It might be desireable to allow separate selection of which types of
play get watched - chequer or cube, possibly chequer, doubling and
responses to doubling.

Anyway, here are patches (unified diffs) for people to consider. If
anyone can tell me why clicking the Tutor box in the Settings/Options
menu doesn't make a permanent change, I'd appreciate that as well.
Apologies for the formatting - my emacs C-mode has it's own idea of
indenting and is set to 4 column tabs, so what looks like it matches
in style when I'm editing may not do so when others see it.

-- 
Jim Segrave           address@hidden


Attachment: tutor.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]