1 /*
2     Sjeng - a chess variants playing program
3     Copyright (C) 2000 Gian-Carlo Pascutto
4 
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 
19     File: protos.h
20     Purpose: function prototypes
21 
22 */
23 
24 #ifndef PROTOS_H
25 #define PROTOS_H
26 
27 long int allocate_time (void);
28 bool check_legal (move_s moves[], int m, int incheck);
29 void comp_to_coord (move_s move, char str[]);
30 void display_board (FILE *stream, int color);
31 long int end_eval (void);
32 long int seval(void);
33 long int std_eval (void);
34 long int suicide_eval (void);
35 long int losers_eval (void);
36 long int eval (void);
37 void gen (move_s moves[]);
38 void ics_game_end (void);
39 bool in_check (void);
40 bool f_in_check (move_s moves[], int m);
41 int extended_in_check (void);
42 void init_game (void);
43 bool is_attacked (int square, int color);
44 bool nk_attacked (int square, int color);
45 bool is_move (char str[]);
46 void make (move_s moves[], int i);
47 void order_moves (move_s moves[], long int move_ordering[], long int see_values[], int num_moves, int best);
48 long int mid_eval (void);
49 long int opn_eval (void);
50 long int suicide_mid_eval(void);
51 void check_phase(void);
52 void perft (int depth);
53 void speed_test(void);
54 void perft_debug (void);
55 void post_thinking (long int score);
56 void post_fl_thinking (long int score, move_s *failmove);
57 void post_fh_thinking (long int score, move_s *failmove);
58 void post_fail_thinking(long int score, move_s *failmove);
59 void print_move (move_s moves[], int m, FILE *stream);
60 void push_pawn (int target, bool is_ep);
61 void push_king_castle (int target, int castle_type);
62 void push_pawn_simple (int target);
63 void push_king (int target);
64 void push_knighT (int target);
65 
66 void try_drop (int ptype);
67 
68 
69 void push_slidE (int target);
70 long int qsearch (int alpha, int beta, int depth);
71 void rdelay (int time_in_s);
72 long int rdifftime (rtime_t end, rtime_t start);
73 bool remove_one (int *marker, long int move_ordering[], int num_moves);
74 void reset_piece_square (void);
75 void check_piece_square (void);
76 void rinput (char str[], int n, FILE *stream);
77 rtime_t rtime (void);
78 long int search (int alpha, int beta, int depth, int is_null);
79 move_s search_root (int alpha, int beta, int depth);
80 void start_up (void);
81 move_s think (void);
82 void toggle_bool (bool *var);
83 void tree (int depth, int indent, FILE *output, char *disp_b);
84 void tree_debug (void);
85 void unmake (move_s moves[], int i);
86 bool verify_coord (char input[], move_s *move);
87 
88 bool is_draw(void);
89 
90 void ProcessHoldings(char line[]);
91 void addHolding(int what, int who);
92 void removeHolding(int what, int who);
93 void DropaddHolding(int what, int who);
94 void DropremoveHolding(int what, int who);
95 
96 void printHolding(void);
97 
98 int SwitchColor(int piece);
99 int SwitchPromoted(int piece);
100 
101 int evalHolding(void);
102 
103 void initialize_zobrist(void);
104 void initialize_hash(void);
105 void initialize_eval(void);
106 
107 void checkECache(long int *score, int *in_cache);
108 void storeECache(long int score);
109 
110 int init_book(void);
111 move_s choose_book_move(void);
112 move_s choose_binary_book_move(void);
113 
114 void StoreTT(int score, int alpha, int beta, int best , int threat, int depth);
115 void QStoreTT(int score, int alpha, int beta, int best);
116 int ProbeTT(int *score, int alpha, int beta, int *best, int *threat, int *donull, int depth);
117 int QProbeTT(int *score, int alpha, int beta, int *best);
118 void LearnStoreTT(int score, unsigned nhash, unsigned hhash, int tomove, int best, int depth);
119 
120 void LoadLearn(void);
121 void Learn(int score, int best, int depth);
122 
123 void pinput (int n, FILE *stream);
124 
125 int calc_attackers(int square, int color);
126 
127 int interrupt(void);
128 
129 void PutPiece(int color, char piece, char file, int rank);
130 void reset_board(void);
131 
132 void reset_ecache(void);
133 
134 void HandlePartner(char *input);
135 void HandlePtell(char *input);
136 void BegForPartner(void);
137 void CheckBadFlow(bool reset);
138 
139 void run_epd_testsuite(void);
140 
141 void ResetHandValue(void);
142 
143 void build_book(void);
144 void comp_to_san (move_s move, char str[]);
145 void stringize_pv (char str[]);
146 
147 void clear_tt(void);
148 void clear_dp_tt(void);
149 
150 move_s proofnumbercheck(move_s compmove);
151 void proofnumbersearch(void);
152 void proofnumberscan(void);
153 
154 void alloc_hash(void);
155 void alloc_ecache(void);
156 void free_hash(void);
157 void free_ecache(void);
158 void read_rcfile(void);
159 
160 void book_learning(int result);
161 void seedMT(unsigned long seed);
162 unsigned long randomMT(void);
163 
164 void setup_epd_line(char* inbuff);
165 
166 int see(int color, int square, int from);
167 
168 void init_egtb(void);
169 int probe_egtb(void);
170 void gen_all_tables(void);
171 int egtb(int s);
172 
173 #endif
174 
175