[Top][All Lists]

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

[Bug-gnubg] Feature Request: Python Support for hint()

From: David Levy
Subject: [Bug-gnubg] Feature Request: Python Support for hint()
Date: Wed, 17 May 2006 08:37:05 -0700

I saw the following discussion in the archives:

>From:  amarganth 
>Subject:  [Bug-gnubg] Python Support 
>Date:  Thu, 5 Aug 2004 10:29:32 +0200 

> The problem is, that I can't get the output of the "hint" command from
> And I don't find another command unter python (dir(gnubg) to get this 
> information.

>From:  Jim Segrave 
>Subject:  Re: [Bug-gnubg] Python Support 
>Date:  Thu, 5 Aug 2004 21:46:55 +0200 

>The trouble is that gnubg.command("hint") doesn't return anything. 

>What's needed is to add another interface function to gnubgmodule.c
>which returns the results of a hint command. I had a qucik look - in
>gnubg.c, CommandHint() looks at the current situation and calls one of
>HintCube(), HintChequer(), or HintResign() as appropriate. Each of
>these get an evaluation of the possible plays, generally into an
>array of floats, then call either the GTK output formatting or print
>output formatting. Changing these to separate out the getting of the
>data and the selecting and calling of the output routines would
>provide the core functionality to return the needed data to a Python
>interface routine. I'd guess you't want gnubg.hint() in Python to
>return a sequence of actions sorted into best equity order and a flag
>indicating what sort of actions might are listed - say a tuple with
>two items, perhaps something like (action, [data])
>where action would be one of "Double" "Pass" "Beaver" "Take" "Resign" pr
>and data would be list of analyses for the various options, 
>  for Double, it would be [double_analysis, no-double-analysis],
>  reversed for Take, etc.
>  for "Move", it would be a list of moves and analyses for the various
>  legal moves, in descending equity order

I am starting to experiment with Python to drive gnubg, and this is a major
stumbling block. 

Now I am running:

        gnubg-cli.exe -p script1.py  >script1.txt

Where script1.py includes


I then run a second python script to read/parse the output of hint

        python script2.py <script1.txt

And script2 parses the ouput of hint. Ugly!!!

It would be so much easier if there was the functionality that Jim proposed
in the August 2004 posting. Any chance of that?


David Levy

reply via email to

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