73 for (i = 0; i < obf->
n_moves; ++i) {
78 if (i == 0) fprintf(f,
" %+d;", obf->
best_score);
94 char *string, *line, *next;
107 if (*
string ==
'%') {
110 }
else if (*
string ==
'\n' || *
string ==
'\r' || *
string ==
'\0') {
119 if (next !=
string) {
121 if (*
string ==
':') ++string;
123 warn(
"missing score in %s (%d) %s %s\n", line, move->
x, next,
string);
132 warn(
"missing best score in %s\n", line);
173 printf(
"\n*** problem # %d ***\n\n", n);
186 for (i = 0; i < obf->
n_moves; ++i) {
191 if (i < obf->n_moves) {
193 printf(
"Erroneous move: ");
194 for (j = 0; j < obf->
n_moves; ++j) {
203 printf(
"Erroneous score: %+d expected", obf->
best_score);
239 printf(
"\n*** problem # %d ***\n\n", n);
298 unsigned long long T = 0, n_nodes = 0;
299 int n = 0, n_bad_score = 0, n_bad_move = 0;
300 double score_error = 0.0, move_error = 0.0;
302 bool print_summary =
false;
311 f = fopen(obf_file,
"r");
313 fprintf(stderr,
"obf_test: cannot open Othello Position Description's file %s\n", obf_file);
316 if (wrong_file && *wrong_file) {
317 w = fopen(wrong_file,
"w");
319 fprintf(stderr,
"obf_test: cannot open Othello Position Description's file %s\n", wrong_file);
335 for (i = 0; i < obf->
n_moves; ++i) {
338 if (i < obf->n_moves) {
345 else print_summary =
true;
351 printf(
"%.30s: ", obf_file);
352 if (n_nodes) printf(
"%llu nodes in ", n_nodes);
354 if (T > 0 && n_nodes > 0) printf(
" (%8.0f nodes/s).", 1000.0 * n_nodes / T);
358 printf(
"%d positions; ", n);
359 printf(
"%d erroneous move; ", n_bad_move);
360 printf(
"%d erroneous score; ", n_bad_score);
361 printf(
"mean absolute score error = %.3f; ", score_error / n);
362 printf(
"mean absolute move error = %.3f\n", move_error / n);
390 if (script_file == NULL || obf_file == NULL) {
391 warn(
"script_to_obf: missing files\n");
394 if (strcmp(script_file, obf_file) == 0) {
395 warn(
"script_to_obf: files should be different\n");
399 i = fopen(script_file,
"r");
401 warn(
"script_to_obf: cannot open script file %s\n", script_file);
404 o = fopen(obf_file,
"w");
406 warn(
"script_to_obf: cannot open obf file %s\n", obf_file);
437void obf_filter(
const char *input_file,
const char *output_file)
441 int n_best, second_best;
445 in = fopen(input_file,
"r");
447 fprintf(stderr,
"obf_filter: cannot open Othello Position Description's file %s\n", input_file);
450 out = fopen(output_file,
"w");
452 fprintf(stderr,
"obf_filter: cannot open Othello Position Description's file %s\n", output_file);
462 for (i = 0; i < obf->
n_moves; ++i) {
466 if (n_best == 1 && second_best == obf->
best_score - 2) {
474 printf(
"OBF filter: %d selected out of %d positions\n", f, n);
488 unsigned long long T = 0, n_nodes = 0;
507 for (i = 0; n == - 1 ?
real_clock() - t < 60000 : i < n; ++i) {
508 const int ply =
MAX(30, 40 - i / 5);
515 if ( result != NULL ) {
524 printf(
"%d positions solved: ", i);
525 if (n_nodes) printf(
"%llu nodes in ", n_nodes);
527 if (T > 0 && n_nodes > 0) printf(
" (%8.0f nodes/s).", 1000.0 * n_nodes / T);
unsigned long long board_get_hash_code(const Board *board)
Compute a hash code.
Definition board.c:1134
void board_print(const Board *board, const int player, FILE *f)
Print out the board.
Definition board.c:1230
char * board_to_string(const Board *board, const int player, char *s)
convert the to a compact string.
Definition board.c:1272
void board_rand(Board *board, int n_ply, Random *r)
Get a random board by playing random moves.
Definition board.c:406
#define SCORE_INF
Definition const.h:52
@ PASS
Definition const.h:37
@ NOMOVE
Definition const.h:37
#define MAX_MOVE
Definition const.h:18
void hash_exclude_move(HashTable *hash_table, const unsigned long long hash_code, const int move)
Erase an hash table entry.
Definition hash-lock-free.c:629
void move_print(const int x, const int player, FILE *f)
Print out a move.
Definition move.c:110
Move * movelist_exclude(MoveList *movelist, const int move)
Exclude a move.
Definition move.c:516
void obf_speed(Search *search, const int n)
Definition obftest.c:534
static void obf_write(OBF *obf, FILE *f)
Write an OBF structure.
Definition obftest.c:65
void obf_free(OBF *obf)
Free an OBF structure.
Definition obftest.c:54
static void obf_build(Search *search, OBF *obf, int n)
Build an OBF structure.
Definition obftest.c:221
void obf_filter(const char *input_file, const char *output_file)
Select hard position from an OBF file.
Definition obftest.c:437
static void obf_search(Search *search, OBF *obf, int n)
Analyze an OBF structure.
Definition obftest.c:159
static int obf_read(OBF *obf, FILE *f)
Read an OBF structure.
Definition obftest.c:92
void script_to_obf(Search *search, const char *script_file, const char *obf_file)
Build an OBF file from a Script file.
Definition obftest.c:378
void _obf_speed(Search *search, const int n, BenchResult *result)
Test edax speed by running for at least 1 minutes on problems deeper and deeper.
Definition obftest.c:484
void obf_test(Search *search, const char *obf_file, const char *wrong_file)
Test an OBF file.
Definition obftest.c:294
@ OBF_PARSE_END
Definition obftest.c:47
@ OBF_PARSE_SKIP
Definition obftest.c:46
@ OBF_PARSE_OK
Definition obftest.c:45
Options options
Definition options.c:22
@ EDAX_TIME_PER_MOVE
Definition options.h:20
void * search_run(void *v)
Search the bestmove of a given board.
Definition root.c:810
void search_set_level(Search *search, const int level, const int n_empties)
Set the search level.
Definition search.c:609
unsigned long long search_count_nodes(Search *search)
Return the number of nodes searched.
Definition search.c:1073
void result_print(Result *result, FILE *f)
Print the current search result.
Definition search.c:1106
void search_cleanup(Search *search)
Clean-up some search data.
Definition search.c:578
void search_set_observer(Search *search, void(*observer)(Result *))
set observer.
Definition search.c:1095
void search_set_board(Search *search, const Board *board, const int player)
Set the board to analyze.
Definition search.c:593
void search_set_move_time(Search *search, const long long t)
set time to search.
Definition search.c:686
void search_observer(Result *result)
default observer.
Definition search.c:1083
long long search_time(Search *search)
Return the time spent by the search.
Definition search.c:1061
void search_set_game_time(Search *search, const long long t)
set time to search.
Definition search.c:671
#define MULTIPV_DEPTH
Definition settings.h:122
unsigned long long T
Definition ui.h:49
int positions
Definition ui.h:51
unsigned long long n_nodes
Definition ui.h:50
unsigned long long player
Definition board.h:27
unsigned long long opponent
Definition board.h:27
int n_moves
Definition move.h:31
int score
Definition move.h:23
int x
Definition move.h:22
char * comments
Definition obftest.c:40
int score
Definition obftest.c:36
int best_score
Definition obftest.c:39
struct OBF::@20 move[MAX_MOVE]
int x
Definition obftest.c:35
int player
Definition obftest.c:33
Board board[1]
Definition obftest.c:32
int n_moves
Definition obftest.c:38
PlayType play_type
Definition options.h:42
int level
Definition options.h:40
int depth
Definition options.h:44
int width
Definition options.h:34
long long time
Definition options.h:41
int selectivity
Definition options.h:45
int verbosity
Definition options.h:32
int move
Definition search.h:44
int score
Definition search.h:45
const char * separator
Definition search.h:145
int n_empties
Definition search.h:99
MoveList movelist[1]
Definition search.h:132
Result * result
Definition search.h:151
const char * header
Definition search.h:144
int player
Definition search.h:100
struct Search::@25 options
int verbosity
Definition search.h:142
int depth
Definition search.h:117
HashTable pv_table[1]
Definition search.h:104
HashTable hash_table[1]
Definition search.h:103
int selectivity
Definition search.h:118
Board board[1]
Definition search.h:96
int multipv_depth
Definition search.h:147
void time_print(long long t, bool justified, FILE *f)
Print time as "D:HH:MM:SS.CC".
Definition util.c:131
char * parse_move(const char *string, const Board *board, Move *move)
Parse a move.
Definition util.c:627
char * string_duplicate(const char *s)
Duplicate a string.
Definition util.c:299
char * parse_int(const char *string, int *result)
Parse an integer.
Definition util.c:761
char * string_read_line(FILE *f)
Read a line.
Definition util.c:265
char * parse_skip_spaces(const char *string)
Skip spaces.
Definition util.c:514
void random_seed(Random *random, const unsigned long long seed)
Pseudo-random number seed.
Definition util.c:1062
char * parse_find(const char *string, const int c)
Find a char.
Definition util.c:545
char * parse_board(const char *string, Board *board, int *player)
Parse a board.
Definition util.c:682
long long real_clock(void)
#define MIN(a, b)
Definition util.h:101
#define warn(...)
Display a warning message as "WARNING : ... ".
Definition util.h:373
#define MAX(a, b)
Definition util.h:98