GoGame

Name

GoGame -- game related information

Synopsis


#include <go-game.h>


struct      GoGame;
GtkObject*  go_game_new                     (GoData *data,
                                             time_t date,
                                             const char *black,
                                             const char *white,
                                             GoBoardSize board,
                                             int handicap,
                                             double komi,
                                             GoGameResult res);
GtkObject*  go_game_new_fake                (GoData *data);
GtkObject*  go_game_read                    (GoData *data,
                                             xmlNodePtr node);
void        go_game_write                   (GoGame *self,
                                             xmlNodePtr node);

enum        GoBoardSize;
const char* board_to_str                    (GoBoardSize board);
GoBoardSize str_to_board                    (const char *str);
enum        GoGameResult;
const char* result_to_str                   (GoGameResult res);
GoGameResult str_to_result                  (const char *str);

Object Hierarchy


  GtkObject
   +----GoGame

Args


  "black"                gpointer             : Read / Write
  "white"                gpointer             : Read / Write
  "board"                gpointer             : Read / Write
  "handicap"             gint                 : Read / Write
  "komi"                 gdouble              : Read / Write

Description

The GoGame type records all information about a single game.

Details

struct GoGame

struct GoGame {
	GoPlayer * black;
	GoPlayer * white;
	GoGameResult res;
	double probability;
};

GoPlayer *blackthe black player
GoPlayer *whitethe white player
GoGameResult resthe game's outcome
double probabilitythe probability value for the game. This is filled in by GoStrengths objects. The value -1 indicates an unknown probability.


go_game_new ()

GtkObject*  go_game_new                     (GoData *data,
                                             time_t date,
                                             const char *black,
                                             const char *white,
                                             GoBoardSize board,
                                             int handicap,
                                             double komi,
                                             GoGameResult res);

Allocate a new GoGame object, fill it with values, and connect it to data.

data : a GoData object
date : the date of the game in the form dd.mm.yyyy
black : the black player's token
white : the white player's token
board : the board size
handicap : the number of handicap stones (in favour of black)
komi : the amount of komi (in favour of white)
res : the game's outcome
Returns : a newly allocated GoGame object.


go_game_new_fake ()

GtkObject*  go_game_new_fake                (GoData *data);

Allocate a new fake GoGame object and connect it to data. This object may be used for internal purposes and does not correspond to a real game. The data must be filled in manually.

data : a GoData object
Returns : a newly allocated GoGame object.


go_game_read ()

GtkObject*  go_game_read                    (GoData *data,
                                             xmlNodePtr node);

This is a constructor for GoGame objects, which reads all data from a XML tree.

data : a GoData object
node : a XML element of type "game"
Returns : a newly allocated GoGame object.


go_game_write ()

void        go_game_write                   (GoGame *self,
                                             xmlNodePtr node);

Dump all game data into node.

self : a GoGame object
node : a XML element of type "game"


enum GoBoardSize

typedef enum { b19=19, b13=13, b9=9 } GoBoardSize;

This type specifies the board size assoziated with a given game. Only the standard board sizes are supported, because the value of handicap stones for other board sizes is not know to the preogram.

b19The usual 19x19 board
b13intermediate size
b9beginners' board


board_to_str ()

const char* board_to_str                    (GoBoardSize board);

Convert board to a human-understandable textual representation.

board : a board size
Returns : the board size as a string.


str_to_board ()

GoBoardSize str_to_board                    (const char *str);

str : 
Returns : 


enum GoGameResult

typedef enum { res_BLACK, res_WHITE, res_JIGO } GoGameResult;

The type to specify a game's outcome.

res_BLACKblack wins
res_WHITEwhite wins
res_JIGOa jigo (draw) occurs


result_to_str ()

const char* result_to_str                   (GoGameResult res);

Convert res to human understandable textual representation.

res : a game result
Returns : the result as a string.


str_to_result ()

GoGameResult str_to_result                  (const char *str);

str : 
Returns : 

Args

"black" (gpointer : Read / Write)

"white" (gpointer : Read / Write)

"board" (gpointer : Read / Write)

"handicap" (gint : Read / Write)

"komi" (gdouble : Read / Write)