From 5d475f9dadcac74bde8262d600e68578e91323c9 Mon Sep 17 00:00:00 2001 From: tslil Date: Mon, 11 Jan 2021 01:29:39 -0500 Subject: Close in principle, but there;s a bug in ct1997 &/ pptdb! --- include/tak.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'include/tak.h') diff --git a/include/tak.h b/include/tak.h index a398b51..532d91a 100644 --- a/include/tak.h +++ b/include/tak.h @@ -1,7 +1,10 @@ +#ifndef TAK_H +#define TAK_H + #include enum E_RESULT {ACT_OK, ACT_ILLEGAL, ACT_OVERFLOW, - PTN_VALID, PTN_INVALID, GAME_END }; + PTN_VALID, PTN_INVALID, GAME_END }; // ------------------------------------------------------------------- // State management @@ -10,8 +13,8 @@ enum COLOUR { C_WHITE, C_BLACK }; enum STONE_VARIANT { STONE_FLAT, STONE_STANDING, STONE_CAPSTONE }; enum MOVE_DIRECTION { M_UP, M_DOWN, M_LEFT, M_RIGHT }; enum WIN_TYPE { WIN_DRAW, - WIN_FLAT_WHITE, WIN_FLAT_BLACK, - WIN_ROAD_WHITE, WIN_ROAD_BLACK, WIN_DRAGON}; + WIN_FLAT_WHITE, WIN_FLAT_BLACK, + WIN_ROAD_WHITE, WIN_ROAD_BLACK, WIN_DRAGON}; typedef uint8_t data_t; typedef uint16_t colour_stack_t; @@ -34,11 +37,11 @@ void next_ply(void); enum E_RESULT try_place(const int8_t location, const enum COLOUR colour, - const enum STONE_VARIANT stone); + const enum STONE_VARIANT stone); enum E_RESULT try_move(const int8_t location, const enum MOVE_DIRECTION direction, - const uint8_t steps, const uint8_t drops[5]); + const uint8_t steps, const uint8_t drops[5]); enum WIN_TYPE check_win(void); @@ -48,25 +51,26 @@ check_win(void); enum E_RESULT parse_place(const uint8_t board_size, char *ptn, - uint8_t *out_location, enum STONE_VARIANT *out_stone); + uint8_t *out_location, enum STONE_VARIANT *out_stone); enum E_RESULT parse_move(const uint8_t board_size, char *ptn, - uint8_t *out_location, enum MOVE_DIRECTION *out_direction, - uint8_t *out_steps, uint8_t out_drops[5]); + uint8_t *out_location, enum MOVE_DIRECTION *out_direction, + uint8_t *out_steps, uint8_t out_drops[5]); void generate_place(const uint8_t board_size, const uint8_t in_location, - const enum STONE_VARIANT in_stone, char out_ptn[4]); + const enum STONE_VARIANT in_stone, char out_ptn[4]); void generate_move(const uint8_t board_size, const uint8_t in_location, - const enum MOVE_DIRECTION in_direction, - const uint8_t in_steps, const uint8_t in_drops[5], - char out_ptn[10]); + const enum MOVE_DIRECTION in_direction, + const uint8_t in_steps, const uint8_t in_drops[5], + char out_ptn[10]); // ------------------------------------------------------------------- // Game driver enum E_RESULT do_ptn(char *ptn); +#endif -- cgit v1.2.3