base.h
Go to the documentation of this file.
1 
11 #ifndef EDAX_BASE_H
12 #define EDAX_BASE_H
13 
14 #include "game.h"
15 #include <stdbool.h>
16 
17 /* structures */
18 struct Search;
19 
24 typedef struct WthorHeader {
25  char century;
26  char year;
27  char month;
28  char day;
29  char board_size;
30  char game_type;
31  char depth;
32  char reserved;
33  unsigned short n;
34  unsigned short game_year;
35  int n_games;
36 } WthorHeader;
37 
38 typedef struct WthorBase {
40  char (*tournament)[26];
42  char (*player)[20];
43  int n_players;
45  int n_games;
46 } WthorBase;
47 
48 typedef struct Base {
50  int n_games;
51  int size;
52 } Base;
53 
54 /* function declarations */
55 void wthor_init(WthorBase*);
56 bool wthor_load(WthorBase*, const char*);
57 bool wthor_save(WthorBase*, const char*);
58 void wthor_test(const char*, struct Search*);
59 void wthor_eval(const char*, struct Search*, unsigned long long histogram[129][65]);
60 void wthor_edaxify(const char*);
61 
62 #define foreach_wthorgame(wgame, wbase) \
63  for ((wgame) = (wbase)->game ; (wgame) < (wbase)->game + (wbase)->header->n_games; ++(wgame))
64 
65 void base_init(Base*);
66 void base_free(Base*);
67 bool base_load(Base*, const char*);
68 void base_save(const Base*, const char*);
69 void base_append(Base*, const Game*);
70 void base_to_problem(Base*, const int, const char*);
71 void base_to_FEN(Base*, const int, const char*);
72 void base_analyze(Base*, struct Search*, const int, const bool);
73 void base_complete(Base*, struct Search*);
74 void base_unique(Base*);
75 void base_compare(const char*, const char*);
76 
77 #endif /* EDAX_BASE_H */
78 
void base_free(Base *)
Free resources of a game database.
Definition: base.c:684
void base_to_problem(Base *, const int, const char *)
Convert a game database to a set of problems.
Definition: base.c:841
Definition: base.h:48
Header for wthor files.
Definition: base.h:24
unsigned short n
Definition: base.h:33
char(* tournament)[26]
Definition: base.h:40
char board_size
Definition: base.h:29
int n_tournaments
Definition: base.h:41
void base_save(const Base *, const char *)
Save a game database.
Definition: base.c:788
void base_analyze(Base *, struct Search *, const int, const bool)
Base analysis.
Definition: base.c:893
bool wthor_save(WthorBase *, const char *)
Save a wthor base.
Definition: base.c:387
char reserved
Definition: base.h:32
WthorGame * game
Definition: base.h:44
int n_players
Definition: base.h:43
Definition: game.h:38
bool wthor_load(WthorBase *, const char *)
Load a wthor base.
Definition: base.c:332
char century
Definition: base.h:25
struct Base Base
void base_init(Base *)
Initialize a game database.
Definition: base.c:672
void wthor_test(const char *, struct Search *)
Test Search with a wthor base.
Definition: base.c:516
void base_to_FEN(Base *, const int, const char *)
Convert a game database to a set of problems.
Definition: base.c:867
void wthor_init(WthorBase *)
Initialize a Wthor base.
Definition: base.c:316
int n_games
Definition: base.h:45
Definition: search.h:95
void base_complete(Base *, struct Search *)
Base analysis.
Definition: base.c:919
int size
Definition: base.h:51
Game * game
Definition: base.h:49
void wthor_eval(const char *, struct Search *, unsigned long long histogram[129][65])
Test Eval with a wthor base.
Definition: base.c:611
WthorHeader header[1]
Definition: base.h:39
char day
Definition: base.h:28
struct WthorBase WthorBase
struct WthorHeader WthorHeader
Header for wthor files.
Definition: game.h:22
char game_type
Definition: base.h:30
char year
Definition: base.h:26
Definition: base.h:38
char depth
Definition: base.h:31
bool base_load(Base *, const char *)
Load a game database.
Definition: base.c:740
void base_unique(Base *)
Make games unique in the game database.
Definition: base.c:720
int n_games
Definition: base.h:50
void wthor_edaxify(const char *)
Change players to "Edax (delorme)" and tourney to "Etudes" in a wthor base.
Definition: base.c:651
void base_append(Base *, const Game *)
Add a game to a game database.
Definition: base.c:696
void base_compare(const char *, const char *)
Base Compare.
Definition: base.c:943
unsigned short game_year
Definition: base.h:34
int n_games
Definition: base.h:35
char month
Definition: base.h:27
char(* player)[20]
Definition: base.h:42