GNU Go Documentation
6.4 Functions which manipulate a Position
All the functions in the engine that manipulate Positions have names
prefixed by gnugo_. These functions still use the two-dimensional
representation of the board (@xref{The Board}). Here is a complete list, as
prototyped in `gnugo.h':
void init_gnugo(float memory)
Initialize the gnugo engine. This needs to be called
once only.
void gnugo_clear_board(int boardsize)
Clear the board.
void gnugo_set_komi(float new_komi)
Set the komi.
void gnugo_add_stone(int i, int j, int color)
Place a stone on the board
void gnugo_remove_stone(int i, int j)
Remove a stone from the board
int gnugo_is_pass(int i, int j)
Return true if (i,j) is PASS_MOVE
void gnugo_play_move(int i, int j, int color)
Play a move and start the clock
int gnugo_undo_move(int n)
Undo n permanent moves. Returns 1 if successful and 0 if it fails.
If n moves cannot be undone, no move is undone.
int gnugo_play_sgfnode(SGFNode *node, int to_move)
Perform the moves and place the stones from the SGF node on the
board. Return the color of the player whose turn it is to move.
int gnugo_play_sgftree(SGFNode *root, int *until, SGFNode **curnode)
Play the moves in ROOT UNTIL movenumber is reached. Return the color of the
player whose turn it is to move.
int gnugo_is_legal(int i, int j, int color)
Interface to is_legal().
int gnugo_is_suicide(int i, int j, int color)
Interface to is_suicide().
int gnugo_placehand(int handicap)
Interface to placehand. Sets up handicap pieces and
returns the number of placed handicap stones.
void gnugo_recordboard(SGFNode *root)
Interface to sgffile_recordboard()
int gnugo_sethand(int handicap, SGFNode *node)
Interface to placehand. Sets up handicap stones and
returns the number of placed handicap stones, updating the sgf file
int gnugo_genmove(int *i, int *j, int color)
Interface to genmove().
int gnugo_attack(int m, int n, int *i, int *j)
Interface to attack().
int gnugo_find_defense(int m, int n, int *i, int *j)
Interface to find_defense().
void gnugo_who_wins(int color, FILE *outfile)
Interface to who_wins().
float gnugo_estimate_score(float *upper, float *lower)
Put upper and lower score estimates into *upper, *lower and
return the average. A positive score favors white. In computing
the upper bound, CRITICAL dragons are awarded to white; in
computing the lower bound, they are awarded to black.
void gnugo_examine_position(int color, int how_much)
Interface to examine_position.
int gnugo_get_komi()
Report the komi.
void gnugo_get_board(int b[MAX_BOARD][MAX_BOARD])
Place the board into the `b' array.
int gnugo_get_boardsize()
Report the board size.
int gnugo_get_move_number()
Report the move number.