-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.h
More file actions
95 lines (79 loc) · 1.99 KB
/
common.h
File metadata and controls
95 lines (79 loc) · 1.99 KB
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
#ifndef __COMMON_H_
#define __COMMON_H_
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <strings.h>
#include <time.h>
#include <unistd.h>
#include <sys/time.h>
#define PROGRAM_VERSION "1.0"
typedef struct {
uint64_t white_pawns;
uint64_t black_pawns;
uint64_t white_knights;
uint64_t black_knights;
uint64_t white_bishops;
uint64_t black_bishops;
uint64_t white_rooks;
uint64_t black_rooks;
uint64_t white_queens;
uint64_t black_queens;
uint64_t white_kings;
uint64_t black_kings;
char white_left_castling;
char white_right_castling;
char black_left_castling;
char black_right_castling;
char color;
char en_passant_x;
unsigned char halfmoves;
} board_t;
typedef struct {
char from_x;
char from_y;
char to_x;
char to_y;
} play_short_t;
typedef struct {
char from_x;
char from_y;
char to_x;
char to_y;
char promotion_option;
} play_t;
typedef struct {
char past_positions[256][56]; // in "short" format, not FEN
play_t past_plays[256];
unsigned int past_plays_count;
unsigned int fullmoves;
char last_play_x;
char last_play_y;
} board_ext_t;
typedef struct {
int64_t hash;
int score_w_type;
} hash_table_entry_t;
#define MAX_SEARCH_DEPTH 5
#define HASH_TABLE_SIZE 8388608
#define TYPE_EXACT 1
#define TYPE_UPPER_BOUND 2
#define TYPE_LOWER_BOUND 3
#define WHITE_COLOR 1
#define BLACK_COLOR 2
#define NO_COLOR 3
#define NO_EN_PASSANT -2
#define PROMOTION_QUEEN 1
#define PROMOTION_KNIGHT 2
#define PROMOTION_BISHOP 3
#define PROMOTION_ROOK 4
#define CASTLING_WHITE_RIGHT 0
#define CASTLING_WHITE_LEFT 1
#define CASTLING_BLACK_RIGHT 2
#define CASTLING_BLACK_LEFT 3
#define MAX_SUPPORTED_OB_RULES 64
void fen_to_board(board_t * board, board_ext_t * board_ext, const char * fen_str);
void board_to_fen(char * fen_str, const board_t * board, const board_ext_t * board_ext);
void board_to_short_string(char * str, const board_t * board);
#endif