[Top][All Lists]

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

[Bug-gnubg] Queries re. Python interface

From: Jim Segrave
Subject: [Bug-gnubg] Queries re. Python interface
Date: Tue, 4 Jan 2005 23:43:02 +0100
User-agent: Mutt/1.4.1i

I'm starting to look at various features to add using Python rather
than embedded C code (that's why I just added a lot of detail to the
doc strings in gnubgmodule.c). A couple of questions:

For testing purposes, it's handy to enter the Python interactive
interpreter with '>>>'. But is there a way to return to gnubg and
still have the interactive interpreter available? Typing ^D returns to
gnubg, but now Python has stdin marked as EOF, so you can't use it

Another query - has anyone tried using Python/tkinter from a script
invoked by gnubg? Are there potential or known problems with creating
tkinter windows from gnubg in GUI mode? I know you won't get window
updates, but perhaps we could provide an interface function to do this
- without it, moving a tkinter window leaves a hole in the gnubg

I'm thinking that creating configuration windows is tedious and
error-prone in C, whereas it's very easy from Python, so if we wanted
to make better use of the database, it would be nice not to have to do
things in C.

I'm also thinking about a self-training feature that I think Python
would be the best way of implementing it - suggestions welcome:

I'd like to have an option to save errors to the database and then
later have a 'self-quiz' which picks a misplayed position from the
database and presents it as a position in gnubg. The user then makes a
choice of moves, after which the script then gives an evaluation of
the new choice and also tells what was played when the error was made.

Things this would involve:

An command to save mistakes from a match - the user should be able to
choose which player's mistakes should be saved (all the errors would
be kept for a 'you' vs. 'the opponent' when played back. The user
should be able to choose whether cube, chequer or both errors should
be saved, the level of error which causes moves to be placed in the
error database, separately for cube and chequer play. Ideally the
database should record additional context - the actual players names,
the game and move number, and the .sgf file name if there is one, so
that the user can go and see the mistake in its actual context if
desired. It could also be useful to allow adding commentary text in
the saved file.

The above is pretty easy - most of the interface routines are already
there, although I'd rather use Python to select the saving options.

The idea would then be that you could ask gnubg to select an error at
random from the database. It would then set the board, score, etc. and
put player 1 as the current player. The user could then opt to either
make a move/cube decision or see the original move/decision which was
made. If they opt to make a move, gnubg should be run until the move
is completed, then control should return to the 'quiz' program which
would run an analysis of the user's choice and offer the option of
seeing the original move and the context/comments/ etc.

If tkinter works as an interface, it would be useful to build gui
scripts for doing simple database related things - adding comments,
filling out extra details - environments, player names, etc. It would
also be useful to have a gui page which creates simple queries for the
saved matches - a collection of selection boxes for setting criteria
for the 'where' part of a select and for choosing which values are
returned - I'm currently doing this sort of thing with pgsql, but
that's not a tool that I think our average user would be comforatable

Comments on any of the above are welcome.

Jim Segrave           address@hidden

reply via email to

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