-
Notifications
You must be signed in to change notification settings - Fork 13
/
mytypes.h
211 lines (169 loc) · 3.85 KB
/
mytypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*
Ordo is program for calculating ratings of engine or chess players
Copyright 2013 Miguel A. Ballicora
This file is part of Ordo.
Ordo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Ordo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Ordo. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(H_MYTYP)
#define H_MYTYP
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
#if defined(MINGW)
#include <windows.h>
#if !defined(MVSC)
#define MVSC
#endif
#endif
#ifdef _MSC_VER
#include <windows.h>
#if !defined(MVSC)
#define MVSC
#endif
#else
#include <unistd.h>
#endif
#if defined(__linux__) || defined(__GNUC__)
#if !defined(GCCLINUX)
#define GCCLINUX
#endif
#endif
#if defined(MINGW)
#undef GCCLINUX
#endif
#if defined(GCCLINUX) || defined(MINGW)
#include <stdint.h>
#elif defined(MVSC)
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
typedef unsigned __int64 uint64_t;
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
typedef __int64 int64_t;
#else
#error OS not defined properly for 64 bit integers
#endif
//===============================================
#include "boolean.h"
enum Player_Performance_Type {
PERF_NORMAL = 0,
PERF_SUPERWINNER = 1,
PERF_SUPERLOSER = 2,
PERF_NOGAMES = 3
};
typedef int64_t gamesnum_t;
typedef int64_t player_t;
struct gamei {
player_t whiteplayer;
player_t blackplayer;
int32_t score;
};
struct GAMES {
gamesnum_t n;
gamesnum_t size;
struct gamei *ga;
};
struct ENC {
double wscore;
player_t wh;
player_t bl;
gamesnum_t played;
gamesnum_t W;
gamesnum_t D;
gamesnum_t L;
};
struct GAMESTATS {
gamesnum_t
white_wins,
draws,
black_wins,
noresult;
};
struct prior {
double value;
double sigma;
bool_t isset;
};
struct relprior {
player_t player_a;
player_t player_b;
double delta;
double sigma;
};
struct DEVIATION_ACC {
double sum1;
double sum2;
double sdev;
};
struct summations {
struct DEVIATION_ACC *relative; // to be dynamically assigned
double *sum1; // to be dynamically assigned
double *sum2; // to be dynamically assigned
double *sdev; // to be dynamically assigned
double wa_sum1;
double wa_sum2;
double dr_sum1;
double dr_sum2;
double wa_sdev;
double dr_sdev;
};
//
struct PLAYERS {
player_t n;
player_t size;
player_t anchored_n;
bool_t perf_set;
const char **name;
bool_t *flagged;
bool_t *present_in_games;
bool_t *prefed;
bool_t *priored;
int *performance_type;
};
struct RATINGS {
player_t size;
player_t *sorted; /* sorted index by rating */
double *obtained;
gamesnum_t *playedby; /* N games played by player "i" */
double *ratingof; /* rating current */
double *ratingbk; /* rating backup */
double *changing; /* direction change vector */
double *ratingof_results;
double *obtained_results;
gamesnum_t *playedby_results;
};
struct ENCOUNTERS {
gamesnum_t n;
gamesnum_t size;
struct ENC *enc;
};
//
struct rel_prior_set {
player_t n;
struct relprior *x; // this points to an array
};
struct output_qualifiers {
bool_t mingames_set;
gamesnum_t mingames;
};
//
struct OUT_INFO {
gamesnum_t W;
gamesnum_t D;
gamesnum_t L;
double opprat; // opponent rating average
double opperr; // opponent rating error average
player_t n_opp;
double diversity;
};
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
#endif