Next: Board Utilities, Previous: General Utilities, Up: Utility Functions
Functions in engine/printutils.c do formatted printing similar to
printf
and its allies. The following formats are recognized:
%c
, %d
, %f
, %s
, %x
These have their usual meaning in formatted output, printing a character, integer, float, string or hexadecimal, respectively.
%o
`Outdent.' Normally output is indented by2*stackp
spaces, so that the depth can be seen at a glance in traces. At the beginning of a format, this%o
inhibits the indentation.
%H
Print a hashvalue.
%C
Print a color as a string.
%m
, %2m
(synonyms)
Takes 2 integers and writes a move, using the two dimensional board representation (see The Board Array)
%1m
Takes 1 integers and writes a move, using the one dimensional board representation (see The Board Array)
We list the non statically declared functions in printutils.c.
void gfprintf(FILE *outfile, const char *fmt, ...)
Formatted output to outfile.
int gprintf(const char *fmt, ...)
Formatted output to stderr. Always returns 1 to allow use in short-circuit logical expressions.
int mprintf(const char *fmt, ...)
Formatted output to stdout.
DEBUG(level, fmt, args...)
If level & debug
, do formatted output to stderr. Otherwise, ignore.
void abortgo(const char *file, int line, const char *msg, int pos)
Print debugging output in an error situation, then exit.
const char * color_to_string(int color)
Convert a color value to a string
const char * location_to_string(int pos)
Convert a location to a string
void location_to_buffer(int pos, char *buf)
Convert a location to a string, writing to a buffer.
int string_to_location(int boardsize, char *str, int *m, int *n)
Get the(m, n)
coordinates in the standard GNU Go coordinate system from the stringstr
. This means that `m' is the nth row from the top and `n' is the column. Both coordinates are between 0 andboardsize-1
, inclusive. Return 1 if ok, otherwise return 0;
int is_hoshi_point(int m, int n)
True if the coordinate is a hoshi point.
void draw_letter_coordinates(FILE *outfile)
Print a line with coordinate letters above the board.
void simple_showboard(FILE *outfile)
Bare bones version of showboard(0)
. No fancy options, no hint of
color, and you can choose where to write it.
The following functions are in showbord.c. Not all public functions in that file are listed here.
void showboard(int xo)
Show go board.xo=0: black and white XO board for ascii game xo=1: colored dragon display xo=2: colored eye display xo=3: colored owl display xo=4: colored matcher status display
const char * status_to_string(int status)
Convert a status value to a string.
const char * safety_to_string(int status)
Convert a safety value to a string.
const char * result_to_string(int result)
Convert a read result to a string