diff options
Diffstat (limited to 'apps/plugins/reversi/reversi-game.h')
-rw-r--r-- | apps/plugins/reversi/reversi-game.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/plugins/reversi/reversi-game.h b/apps/plugins/reversi/reversi-game.h index a13d336d45..de05df78f9 100644 --- a/apps/plugins/reversi/reversi-game.h +++ b/apps/plugins/reversi/reversi-game.h | |||
@@ -23,11 +23,11 @@ | |||
23 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | #include "plugin.h" | 24 | #include "plugin.h" |
25 | 25 | ||
26 | #define WHITE 1 /* WHITE constant, it always plays first (as in chess) */ | 26 | #define WHITE 1 /* WHITE constant, it always plays first (as in chess) */ |
27 | #define BLACK 2 /* BLACK constant */ | 27 | #define BLACK -1 /* BLACK constant */ |
28 | #define FREE 0 /* Free place constant */ | 28 | #define FREE 0 /* Free place constant */ |
29 | 29 | ||
30 | #define BOARD_SIZE 8 | 30 | #define BOARD_SIZE 8 |
31 | #define INIT_STONES 4 | 31 | #define INIT_STONES 4 |
32 | 32 | ||
33 | /* Description of a move. A move is stored as a byte in the following format: | 33 | /* Description of a move. A move is stored as a byte in the following format: |
@@ -50,7 +50,7 @@ typedef unsigned char move_t; | |||
50 | /* State of a board */ | 50 | /* State of a board */ |
51 | typedef struct _reversi_board_t { | 51 | typedef struct _reversi_board_t { |
52 | /* The current state of the game (BLACK/WHITE/FREE) */ | 52 | /* The current state of the game (BLACK/WHITE/FREE) */ |
53 | char board[BOARD_SIZE][BOARD_SIZE]; | 53 | int board[BOARD_SIZE][BOARD_SIZE]; |
54 | 54 | ||
55 | /* Game history. First move (mostly, but not necessarily, black) is stored | 55 | /* Game history. First move (mostly, but not necessarily, black) is stored |
56 | * in history[0], second move (mostly, but not necessarily, white) is | 56 | * in history[0], second move (mostly, but not necessarily, white) is |
@@ -64,8 +64,7 @@ typedef struct _reversi_board_t { | |||
64 | 64 | ||
65 | void reversi_init_game(reversi_board_t *game); | 65 | void reversi_init_game(reversi_board_t *game); |
66 | int reversi_flipped_color(const int color); | 66 | int reversi_flipped_color(const int color); |
67 | bool reversi_game_is_finished(const reversi_board_t *game); | 67 | bool reversi_game_is_finished(const reversi_board_t *game, int cur_player); |
68 | int reversi_get_turn(const reversi_board_t *game); | ||
69 | int reversi_count_occupied_cells(const reversi_board_t *game, | 68 | int reversi_count_occupied_cells(const reversi_board_t *game, |
70 | int *white_count, int *black_count); | 69 | int *white_count, int *black_count); |
71 | int reversi_count_moves(const reversi_board_t *game); | 70 | int reversi_count_moves(const reversi_board_t *game); |
@@ -77,6 +76,7 @@ int reversi_is_valid_move(const reversi_board_t *game, | |||
77 | const int row, const int col, const int player); | 76 | const int row, const int col, const int player); |
78 | int reversi_count_player_available_moves(const reversi_board_t *game, | 77 | int reversi_count_player_available_moves(const reversi_board_t *game, |
79 | const int player); | 78 | const int player); |
79 | int reversi_count_passes(const reversi_board_t *game, const int player); | ||
80 | 80 | ||
81 | 81 | ||
82 | #endif | 82 | #endif |