bug-gnubg
[Top][All Lists]
Advanced

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

[Bug-gnubg] Relational database things


From: Jim Segrave
Subject: [Bug-gnubg] Relational database things
Date: Sun, 18 Sep 2005 16:31:04 +0200
User-agent: Mutt/1.4.2.1i

I got totally stuck making any real inroads on the neural net input
evaluation, so I went back to my idea for a database of errors. As a
start for this I've done a couple of other things:

1) there are database creation scripts which will add tables for games
   and their statistics. This allows you to query stats for all
   crawford games, or all 2-away 3-away or whatever (scords in the
   game table are kept in terms of away, not points

   there are 2 tables:

   game, which uses match_id as a foreign key and contains the
   starting score (expressed as n-away m-away, players as nick_id's,
   result (positive points for player 0 winning, negative for player
   1), game number 0..n, and crawford 0 = not, 1 = is crawford game

   gamestat which uses game_id as a foreign key and contains identical
   data to matchstat (perhaps I should have reused the table, but I
   forsaw problems with that)

2) I never liked having the database name embedded in relational.py -
   if you want to have different database or use a password or a
   remote RDBMS server, you needed to hack on relational.py. I've
   modified that so that if it finds ~/.gnubg/database, it parses
   lines out of there - you can set the database type (sqlite,
   postgres, mysql), the host, user, password, whether you want game
   stats recorded in this file. If the file isn't found, relational.py
   should continue as before (using database name gnubg or data.db, no
   user, no password, no host

3) for a laugh, I put in an ugly hack to rename the match table to
   match_tbl if you want to use mysql. I'm not sure everything is
   right - cascading deletes of games records when you delete a match
   didn't happen (but I've not tested this under postgres either)

To use this you have to:

create a database, using gnubg.game.(my)sql or look inside and to the
appropriate bits to add the tables to an existing database

copy 'database' to your home .gnubg/ directory and edit the line:

gnubg*games no 
 to
gnubg*games yes

Edit any other parameters as needed - for example, to use a mysql rdbms on
server.example.org, port 2204, where the database name is backgammon, your
username is woolsey and your password is number1, you'd put:

gnubg*type     mysql
gnubg*database backgammon
gnubg*user     woolsey
gnubg*password number1
gnubg*host     server.example.org:2005

Then chmod our file to 600 so other's can't read your password

-- 
Jim Segrave           address@hidden





reply via email to

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