My Project
game.h
Go to the documentation of this file.
1
11#ifndef EDAX_GAME_H
12#define EDAX_GAME_H
13
14#include "board.h"
15#include "move.h"
16
17#include <stdio.h>
18
19/* structures */
20struct Random;
21
22typedef struct Game {
24 struct {
25 short year;
26 signed char month;
27 signed char day;
28 signed char hour;
29 signed char minute;
30 signed char second;
32 char name[2][32];
33 char move[60];
34 char player;
35 unsigned long long hash;
37
38typedef struct WthorGame {
40 signed char score, theoric_score;
41 char x[60];
43
44typedef struct OkoGame {
45 char n;
46 signed char score;
47 char flag;
48 char move[61];
50
51/* function declarations */
52void game_init(Game*);
53void game_copy(Game*, const Game*);
54bool game_get_board(const Game*, const int, Board*);
55bool game_update_board(Board *board, int x);
56bool game_check(Game*);
57bool game_equals(const Game*, const Game*);
58void wthor_to_game(const WthorGame*, Game*);
59void game_to_wthor(const Game*, WthorGame*);
60void game_read(Game*, FILE*);
61void game_write(const Game*, FILE*);
62void game_import_text(Game*, FILE*);
63void game_import_wthor(Game*, FILE*);
64void game_import_ggf(Game*, FILE*);
65void game_import_sgf(Game*, FILE *);
66char *parse_ggf(Game*, const char*);
67void game_import_pgn(Game*, FILE *);
68void game_export_text(const Game*, FILE*);
69void game_export_ggf(const Game*, FILE*);
70void game_save_sgf(const Game*, FILE *, const bool);
71void game_export_sgf(const Game*, FILE *);
72void game_export_pgn(const Game*, FILE *);
73void game_export_wthor(const Game*, FILE*);
74void game_export_eps(const Game*, FILE *);
75void game_export_svg(const Game*, FILE *);
76void game_import_oko(Game*, FILE*);
77void game_import_gam(Game*, FILE *);
78void game_rand(Game*, int, struct Random*);
79int game_analyze(Game*, struct Search*, const int, const bool);
80int game_complete(Game*, struct Search*);
81void line_to_game(const Board*, const Line*, Game*);
82int game_score(const Game*);
83int move_from_wthor(int);
84
85#endif /* EDAX_GAME_H */
void game_import_oko(Game *, FILE *)
Read a game from the "allinf.oko" file.
Definition: game.c:513
bool game_check(Game *)
Check a game.
Definition: game.c:213
void game_export_wthor(const Game *, FILE *)
Write a game to a Wthor file.
Definition: game.c:500
bool game_update_board(Board *board, int x)
update a board.
Definition: game.c:153
void line_to_game(const Board *, const Line *, Game *)
Build a game from an initial position and a move sequence.
Definition: game.c:415
void game_export_ggf(const Game *, FILE *)
Write a game to the Generic Game Format (ggf) file.
Definition: game.c:713
void game_import_sgf(Game *, FILE *)
Read a game from a sgf file.
Definition: game.c:823
void game_import_wthor(Game *, FILE *)
Read a game from a Wthor file.
Definition: game.c:487
void game_copy(Game *, const Game *)
Game copy.
Definition: game.c:103
bool game_equals(const Game *, const Game *)
Test if two games are equal.
Definition: game.c:114
void game_read(Game *, FILE *)
Read a game from a binary file.
Definition: game.c:429
void game_save_sgf(const Game *, FILE *, const bool)
Write a game to the Generic Game Format (ggf) file.
Definition: game.c:870
void game_export_sgf(const Game *, FILE *)
Definition: game.c:944
int game_score(const Game *)
Compute the final score of the game, for the initial player.
Definition: game.c:233
bool game_get_board(const Game *, const int, Board *)
Get the board after 'ply' move.
Definition: game.c:195
void wthor_to_game(const WthorGame *, Game *)
convert a Wthor game to a Game.
Definition: game.c:340
void game_import_text(Game *, FILE *)
Read a game from a text file.
Definition: game.c:451
void game_export_text(const Game *, FILE *)
Write a game to a text file.
Definition: game.c:467
void game_init(Game *)
Create an empty game.
Definition: game.c:83
void game_export_eps(const Game *, FILE *)
Write a game to an eps file.
Definition: game.c:1264
void game_import_ggf(Game *, FILE *)
Read a game from the Generic Game Format (ggf) file.
Definition: game.c:582
void game_write(const Game *, FILE *)
Write a game to a binary file.
Definition: game.c:440
void game_export_svg(const Game *, FILE *)
Definition: game.c:1409
void game_import_gam(Game *, FILE *)
void game_import_pgn(Game *, FILE *)
Read a game from a pgn file.
Definition: game.c:955
void game_rand(Game *, int, struct Random *)
Fill a game with some random moves.
Definition: game.c:1497
char * parse_ggf(Game *, const char *)
Parse a ggf game from a string.
Definition: game.c:664
void game_export_pgn(const Game *, FILE *)
Write a game to a pgn file.
Definition: game.c:1203
int game_complete(Game *, struct Search *)
Terminate an unfinished game.
Definition: game.c:1625
int game_analyze(Game *, struct Search *, const int, const bool)
Analyze an endgame.
Definition: game.c:1532
int move_from_wthor(int)
Coordinates conversion from wthor to edax.
Definition: game.c:38
void game_to_wthor(const Game *, WthorGame *)
convert a Game to a Whor game.
Definition: game.c:366
Definition: board.h:26
Definition: game.h:22
char move[60]
Definition: game.h:33
signed char second
Definition: game.h:30
signed char day
Definition: game.h:27
struct Game::@14 date
signed char month
Definition: game.h:26
char name[2][32]
Definition: game.h:32
unsigned long long hash
Definition: game.h:35
Board initial_board[1]
Definition: game.h:23
signed char minute
Definition: game.h:29
short year
Definition: game.h:25
signed char hour
Definition: game.h:28
char player
Definition: game.h:34
Definition: move.h:35
Definition: game.h:44
char n
Definition: game.h:45
char flag
Definition: game.h:47
signed char score
Definition: game.h:46
char move[61]
Definition: game.h:48
Definition: util.h:87
Definition: search.h:95
Definition: game.h:38
signed char theoric_score
Definition: game.h:40
char x[60]
Definition: game.h:41
short tournament
Definition: game.h:39
signed char score
Definition: game.h:40
short white
Definition: game.h:39
short black
Definition: game.h:39