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