|
|
/*
|
/*
|
|
|
connectk -- a program to play the connect-k family of games
|
connectk -- a program to play the connect-k family of games
|
Copyright (C) 2007 Michael Levin
|
Copyright (C) 2007 Michael Levin
|
|
|
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
|
|
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
GNU General Public License for more details.
|
GNU General Public License for more details.
|
|
|
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
*/
|
*/
|
|
|
/*
|
/*
|
* User Interface
|
* User Interface
|
*/
|
*/
|
|
|
#ifdef __GTK_H__
|
#ifdef __GTK_H__
|
void add_tests_to_menu_shell(GtkWidget *menu);
|
void add_tests_to_menu_shell(GtkWidget *menu);
|
#endif
|
#endif
|
|
|
void setup_move(void);
|
void setup_move(void);
|
void tree_view_clear(unsigned int from);
|
void tree_view_clear(unsigned int from);
|
|
|
/*
|
/*
|
* Private game state
|
* Private game state
|
*/
|
*/
|
|
|
enum {
|
enum {
|
SEARCH_NONE,
|
SEARCH_NONE,
|
SEARCH_DFS,
|
SEARCH_DFS,
|
SEARCHES
|
SEARCHES
|
};
|
};
|
typedef int SEARCH;
|
typedef int SEARCH;
|
|
|
typedef struct {
|
typedef struct {
|
PLAYER ai;
|
PLAYER ai;
|
SEARCH search;
|
SEARCH search;
|
int depth, branch, cache, tss;
|
int depth, branch, cache, tss;
|
} Player;
|
} Player;
|
|
|
extern int move_last, tournament;
|
extern int move_last, tournament;
|
extern Player players[PIECES];
|
extern Player players[PIECES];
|
#define PLAYER_HUMAN 0
|
#define PLAYER_HUMAN 0
|
|
|
void clear_history(unsigned int from_move);
|
void clear_history(unsigned int from_move);
|
void go_to_move(unsigned int move);
|
void go_to_move(unsigned int move);
|
void make_move(BCOORD x, BCOORD y);
|
void make_move(BCOORD x, BCOORD y);
|
void new_game(unsigned int size);
|
void new_game(unsigned int size);
|
void set_board_size(unsigned int size);
|
void set_board_size(unsigned int size);
|
char *search_to_string(SEARCH s);
|
char *search_to_string(SEARCH s);
|
|
|
/*
|
/*
|
* Move list files
|
* Move list files
|
*/
|
*/
|
|
|
int load_moves_list(const char *filename);
|
int load_moves_list(const char *filename);
|
int save_moves_list(const char *filename);
|
int save_moves_list(const char *filename);
|
|
|
/*
|
/*
|
* Game board drawing
|
* Game board drawing
|
*/
|
*/
|
|
|
#ifdef __GTK_H__
|
#ifdef __GTK_H__
|
GtkWidget *draw_init(void);
|
GtkWidget *draw_init(void);
|
#endif
|
#endif
|
void draw_board_sized(int size);
|
void draw_board_sized(int size);
|
#define draw_board() draw_board_sized(0)
|
#define draw_board() draw_board_sized(0)
|
void draw_tile(BCOORD x, BCOORD y);
|
void draw_tile(BCOORD x, BCOORD y);
|
void draw_playable(int yes);
|
void draw_playable(int yes);
|
void draw_win(void);
|
void draw_win(void);
|
void draw_marks(AIMoves *moves, int redraw);
|
void draw_marks(AIMoves *moves, int redraw);
|
void clear_last_moves(void);
|
void clear_last_moves(void);
|
void draw_last_moves(void);
|
void draw_last_moves(void);
|
void draw_screenshot(const char *filename);
|
void draw_screenshot(const char *filename);
|
|
|
/*
|
/*
|
* AI players
|
* AI players
|
*/
|
*/
|
|
|
const char *player_to_string(PLAYER player);
|
const char *player_to_string(PLAYER player);
|
int number_of_ais(void);
|
int number_of_ais(void);
|
AI *ai(int n);
|
AI *ai(int n);
|
AIMoves *run_ai(Player *player);
|
AIMoves *run_ai(Player *player);
|
void stop_ai(void);
|
void stop_ai(void);
|
void start_ai(void);
|
void start_ai(void);
|
void halt_ai_thread(void);
|
void halt_ai_thread(void);
|
void start_ai_thread(void);
|
void start_ai_thread(void);
|
void search(const Board *b, AIMoves *moves, Player *player);
|
void search(const Board *b, AIMoves *moves, Player *player);
|
|
|
/*
|
/*
|
* Dialogs
|
* Dialogs
|
*/
|
*/
|
|
|
#ifdef __GTK_H__
|
#ifdef __GTK_H__
|
typedef struct {
|
typedef struct {
|
GtkWidget *window, *combo, *search[SEARCHES], *depth, *branch, *cache,
|
GtkWidget *window, *combo, *search[SEARCHES], *depth, *branch, *cache,
|
*tss;
|
*tss;
|
Player *player;
|
Player *player;
|
} PlayerDialog;
|
} PlayerDialog;
|
|
|
extern PlayerDialog player_dialog[PIECES];
|
extern PlayerDialog player_dialog[PIECES];
|
|
|
void new_game_dialog_init(void);
|
void new_game_dialog_init(void);
|
void open_new_game_dialog(GtkMenuItem *item, gpointer user_data);
|
void open_new_game_dialog(GtkMenuItem *item, gpointer user_data);
|
void open_file_dialog(GtkMenuItem *item, gpointer user_data);
|
void open_file_dialog(GtkMenuItem *item, gpointer user_data);
|
void save_file_dialog(GtkMenuItem *item, gpointer user_data);
|
void save_file_dialog(GtkMenuItem *item, gpointer user_data);
|
void tourney_dialog_init(void);
|
void tourney_dialog_init(void);
|
void tourney_result(PIECE win, int moves);
|
void tourney_result(PIECE win, int moves);
|
void open_tourney_dialog(GtkWidget *menuitem);
|
void open_tourney_dialog(GtkWidget *menuitem);
|
void player_dialog_init(PlayerDialog *pd, PIECE player);
|
void player_dialog_init(PlayerDialog *pd, PIECE player);
|
void open_player_dialog(GtkWidget *menuitem, PlayerDialog *pd);
|
void open_player_dialog(GtkWidget *menuitem, PlayerDialog *pd);
|
void screenshot_dialog(void);
|
void screenshot_dialog(void);
|
#endif
|
#endif
|
|
|