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#include <stdint.h>
28
29int32_t allocate_time (void);
30bool check_legal (move_s moves[], int m, int incheck);
31void comp_to_coord (move_s move, char str[]);
32void display_board (FILE *stream, int color);
33int32_t end_eval (void);
34int32_t seval(void);
35int32_t std_eval (void);
36int32_t suicide_eval (void);
37int32_t losers_eval (void);
38int32_t eval (void);
39void gen (move_s moves[]);
40void ics_game_end (void);
41bool in_check (void);
42bool f_in_check (move_s moves[], int m);
43int extended_in_check (void);
44void init_game (void);
45bool is_attacked (int square, int color);
46bool nk_attacked (int square, int color);
47bool is_move (char str[]);
48void make (move_s moves[], int i);
49void order_moves (move_s moves[], int32_t move_ordering[], int32_t see_values[], int num_moves, int best);
50int32_t mid_eval (void);
51int32_t opn_eval (void);
52int32_t suicide_mid_eval(void);
53void check_phase(void);
54void perft (int depth);
55void speed_test(void);
56void perft_debug (void);
57void post_thinking (int32_t score);
58void post_fl_thinking (int32_t score, move_s *failmove);
59void post_fh_thinking (int32_t score, move_s *failmove);
60void post_fail_thinking(int32_t score, move_s *failmove);
61void print_move (move_s moves[], int m, FILE *stream);
62void push_pawn (int target, bool is_ep);
63void push_king_castle (int target, int castle_type);
64void push_pawn_simple (int target);
65void push_king (int target);
66void push_knighT (int target);
67
68void try_drop (int ptype);
69
70
71void push_slidE (int target);
72int32_t qsearch (int alpha, int beta, int depth);
73void rdelay (int time_in_s);
74int32_t rdifftime (rtime_t end, rtime_t start);
75bool remove_one (int *marker, int32_t move_ordering[], int num_moves);
76void reset_piece_square (void);
77void check_piece_square (void);
78void rinput (char str[], int n, FILE *stream);
79rtime_t rtime (void);
80int32_t search (int alpha, int beta, int depth, int is_null);
81move_s search_root (int alpha, int beta, int depth);
82void start_up (void);
83move_s think (void);
84void toggle_bool (bool *var);
85void tree (int depth, int indent, FILE *output, char *disp_b);
86void tree_debug (void);
87void unmake (move_s moves[], int i);
88bool verify_coord (char input[], move_s *move);
89
90bool is_draw(void);
91
92void ProcessHoldings(char line[]);
93void addHolding(int what, int who);
94void removeHolding(int what, int who);
95void DropaddHolding(int what, int who);
96void DropremoveHolding(int what, int who);
97
98void printHolding(void);
99
100int SwitchColor(int piece);
101int SwitchPromoted(int piece);
102
103int evalHolding(void);
104
105void initialize_zobrist(void);
106void initialize_hash(void);
107void initialize_eval(void);
108
109void checkECache(int32_t *score, int *in_cache);
110void storeECache(int32_t score);
111
112int init_book(void);
113move_s choose_book_move(void);
114move_s choose_binary_book_move(void);
115
116void StoreTT(int score, int alpha, int beta, int best , int threat, int depth);
117void QStoreTT(int score, int alpha, int beta, int best);
118int ProbeTT(int *score, int alpha, int beta, int *best, int *threat, int *donull, int depth);
119int QProbeTT(int *score, int alpha, int beta, int *best);
120void LearnStoreTT(int score, unsigned nhash, unsigned hhash, int tomove, int best, int depth);
121
122void LoadLearn(void);
123void Learn(int score, int best, int depth);
124
125void pinput (int n, FILE *stream);
126
127int calc_attackers(int square, int color);
128
129int interrupt(void);
130
131void PutPiece(int color, char piece, char file, int rank);
132void reset_board(void);
133
134void reset_ecache(void);
135
136void HandlePartner(char *input);
137void HandlePtell(char *input);
138void BegForPartner(void);
139void CheckBadFlow(bool reset);
140
141void run_epd_testsuite(void);
142
143void ResetHandValue(void);
144
145void build_book(void);
146void comp_to_san (move_s move, char str[]);
147void stringize_pv (char str[]);
148
149void clear_tt(void);
150void clear_dp_tt(void);
151
152move_s proofnumbercheck(move_s compmove);
153void proofnumbersearch(void);
154void proofnumberscan(void);
155
156void alloc_hash(void);
157void alloc_ecache(void);
158void free_hash(void);
159void free_ecache(void);
160void read_rcfile(void);
161
162void book_learning(int result);
163void seedMT(uint32_t seed);
164uint32_t randomMT(void);
165
166void setup_epd_line(char* inbuff);
167
168int see(int color, int square, int from);
169
170void gen_all_tables(void);
171int egtb(int s);
172
173#endif
174
175