1 /* DreamChess 2 ** 3 ** DreamChess is the legal property of its developers, whose names are too 4 ** numerous to list here. Please refer to the AUTHORS.txt file distributed 5 ** with this source distribution. 6 ** 7 ** This program is free software: you can redistribute it and/or modify 8 ** it under the terms of the GNU General Public License as published by 9 ** the Free Software Foundation, either version 3 of the License, or 10 ** (at your option) any later version. 11 ** 12 ** This program is distributed in the hope that it will be useful, 13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 ** GNU General Public License for more details. 16 ** 17 ** You should have received a copy of the GNU General Public License 18 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #ifndef DREAMER_DREAMER_H 22 #define DREAMER_DREAMER_H 23 24 #include "board.h" 25 #include "timer.h" 26 27 #define MODE_WHITE 0 28 #define MODE_BLACK 1 29 #define MODE_IDLE 2 30 #define MODE_FORCE 3 31 #define MODE_QUIT 4 32 33 #define FLAG_IGNORE_MOVE (1 << 0) 34 #define FLAG_NEW_GAME (1 << 1) 35 #define FLAG_PONDER (1 << 2) 36 #define FLAG_DELAY_MOVE (1 << 2) 37 38 #define MAX_DEPTH 30 39 40 typedef struct { 41 bitboard_t en_passant; 42 int castle_flags; 43 int fifty_moves; 44 move_t move; 45 } undo_data_t; 46 47 struct time_control { 48 int mps; 49 int base; 50 int inc; 51 }; 52 53 typedef struct state { 54 int done; 55 int mode; 56 int flags; 57 int depth; 58 board_t board; 59 board_t root_board; 60 undo_data_t *undo_data; 61 int moves; 62 int options; 63 struct time_control time; 64 timer engine_time; 65 timer move_time; 66 move_t hint; 67 move_t ponder_opp_move; 68 move_t ponder_my_move; 69 move_t ponder_actual_move; 70 } state_t; 71 72 int my_turn(state_t *state); 73 74 #define STATE_NORMAL 0 75 #define STATE_CHECK 1 76 #define STATE_MATE 2 77 #define STATE_STALEMATE 3 78 79 #define OPTION_QUIESCE 0 80 #define OPTION_POST 1 81 #define OPTION_PONDER 2 82 83 int engine(void *data); 84 int check_game_state(board_t *board, int ply); 85 void check_game_end(state_t *state); 86 void do_move(state_t *state, move_t move); 87 void undo_move(state_t *state); 88 int check_abort(int ply); 89 int get_option(int option); 90 void set_option(int option, int value); 91 int get_time(void); 92 int is_check(board_t *board, int ply); 93 void send_move(state_t *state, move_t move); 94 void set_move_time(void); 95 96 #endif 97