bug-gnubg
[Top][All Lists]
Advanced

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

Re: [Bug-gnubg] Anomolous looking code in eval.c


From: Joern Thyssen
Subject: Re: [Bug-gnubg] Anomolous looking code in eval.c
Date: Mon, 15 Jul 2002 18:37:02 +0000
User-agent: Mutt/1.2.5.1i

On Mon, Jul 15, 2002 at 04:06:14PM +0200, Jim Segrave wrote

> As to what I was looking for in a Teaching mode:
[snip]
> I've done the easy bits - adding a Tutor setting and re-using the
> GetYN() routines. I'm now looking at how the evaluations can be done. 
> I'm struggling my way through the code which does cube decisions,
> trying to see what I can use and how I can ensure that I won't
> inadvertantly alter the game state. Then I need to do the same to get
> the equity values for a move before it's committed and entered into
> the list of moves. I have to admit, although it's hardly surprising,
> that the cube equity calculation routines seem difficult to
> disentagle. 
> 
> Anyone who can give me pointers on the best way to use the existing
> routines to:
> 
> Decide if cube action is called for and what the equity loss of not
> doubling/redoubling is.
> 
> Decide if a Take/Pass/Resign is a reasonably good choice
> 
> Get a hint list in the form of the raw numeric data for equities.
> 
> And of course any warnings about things like 'calling this routine
> will screw up the game/match state, so you'll need to copy it and work
> n a copy' or similar caveats. 

CommandHint in gnubg.c is a good place to start.

For example, to evaluate cube decision you basically have to

   /* set-up internal cube info struct from current match state */
   GetMatchStateCubeInfo ( &ci, &ms );
    
   /* Evaluate cube decision */
   GeneralCubeDecisionE ( aarOutput, ms.anBoard, &ci, &esEvalCube.ec );

   cd = FindCubeDecision ( arDouble, aarOutput, &ci );


   arDouble will now contain the equity for no double, double-take, and
   double-pass, and cd indicates the correct cube action.

In the rest of CommandHint you can see code for determining resignations,
take decisions, and chequer play decisions. It's relatively
straightforward, but don't hesitate to ask if you have further
questions. 

I've tried to implement something similar to a tutor-mode, but had some
trouble with the GTK interface. While the program is analysing the human
player's moves, GTK is "frozen", but remembers your mouse clicks, and goes
totally bananas after finishing the analysis if you've clicked around
while waiting for the analysis to finish.

My code for auto-analysis can be found in autoAnalyseMove in play.c

> 
> Also warnings about unexpected and unpleasant interactions - it would
> not be good for instance to have pop-ups appear while stepping through
> an annotaion window or simply revieing a move list of a completed
> game.
> 
> And finally - a minor wish-list/suggestion.
> 
> I'd like it if it were possible to possble to select a level
> (doubtful/bad/vary bad) for cube and chequer play lines in the
> annotation window, such that all moves worse than the chosen threshold
> were highlighted (perhaps by a different background in that side of
> the play list. On those rare occasions when I manage to get through a
> lengthy game with gnubg without making too many errors, I may want to
> review the analysis and quickly skip to the moves which were
> notable. I already know from the show statistics game that there are
> only a couple of moves which were marked, but there are 54 unmarked
> ones that I don't want to re-examine. Even better would be if the
> highlighting could be different for: 
> 
> bad cube decisions 
> bad chequer play 
> both in one move

In the gamelist (Window->Game list) moves and cube decisions are marked
with ! and ?. Unfortunately it's very difficult to use colorisations in
the widget used for the game list with GTK 1.2. However, it should be
fixed with GTK 2.0, so we might implement that soon. Also, on my todo
list is a feature similar to snowie where you can skip forward to, e.g., 
errors and blunders. I've uncommited code for the CLI commands, but need
to figure out how to implement it in the GUI.

Let me know if you need write access to CVS, e.g., if you wish to make a
branch where you can play around or wish to commit code to the main
branch.

Jørn

-- 
Joern Thyssen, PhD
Vendsysselgade 3, 3., DK-9000 Aalborg, Denmark
+45 9813 2791 (private) / +45 2077 2689 (mobile) / +45 9633 7036 (work)



reply via email to

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