[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnubg] (no subject)
From: |
Joern Thyssen |
Subject: |
Re: [Bug-gnubg] (no subject) |
Date: |
Mon, 11 Aug 2003 09:22:30 +0000 |
User-agent: |
Mutt/1.4.1i |
On Mon, Aug 11, 2003 at 01:20:13AM +0200, address@hidden wrote
> Hi,
>
> I've been fiddeling around with python to try to come up with some batch
> script to import, analyse and export bad moves all in one go - here is the
> result. Thought I would post the script here if someone need an example. At
> the
> same time maybe I can get some questions answered....
>
> After setting the default paths, I still can't get the commands to work
> without full path for the filename.
> What am I doing wrong?
The default paths are only used in the GUI, so if you issue a "save
match xxx.sgf" the file is saved relative to the current directory.
>
> I need a way to get the player on roll name, like "show turn", but how do I
> read it from python... maybe it isn't supported yet? Any suggestions on how I
> can use "show turn" to get the name anyway?
The python support is very much in progress. I'm sure that there will be
a way to get this once the python support is finished.
> Is it possible to get more information about the analysis, like lost equity
> for a move etc?
Yes, once the code is finished.
> for importfile in os.listdir(import_path):
>
> if os.path.splitext(importfile)[1] != ".sgg":
> continue
>
> prevpos = gnubg.positionid()
> os.chdir(import_path)
> gnubg.command("import sgg " + "\"" + importfile + "\"")
> gnubg.command("analyse clear session")
> gnubg.command("analyse match")
> os.chdir(gnubg_path) # this is needed for the record command (???)
> gnubg.command("record add match")
This part of your code will probably not be changed, but the loop over
positions will eventually be replaced by a native python loop, perhaps
someting like:
m = gnubg.match()
for igame in range(len(m)):
g=m[igame]
for imove in range(len(g)):
move=g[imove]
if move[ "type" ] = "normal":
blah blah
Jørn
pgpzprzMYIgiy.pgp
Description: PGP signature