summaryrefslogtreecommitdiff
path: root/include/hybbx/chess.h
diff options
context:
space:
mode:
authorinfo@mode42.com <info@mode42.com>2026-08-09 11:54:17 +0000
committerinfo@mode42.com <info@mode42.com>2026-08-09 11:54:17 +0000
commita989bd16c40e04bba5a5404b0ef0cd22f19d2707 (patch)
tree604a0439c7d8c022cbd483d62bdc2cfc1c8d18f8 /include/hybbx/chess.h
parenta72e5ea7558e5172c08d397d6f1e0e0f9273e694 (diff)
now including entertain/chess
Diffstat (limited to 'include/hybbx/chess.h')
-rw-r--r--include/hybbx/chess.h106
1 files changed, 0 insertions, 106 deletions
diff --git a/include/hybbx/chess.h b/include/hybbx/chess.h
deleted file mode 100644
index bdfaa7b..0000000
--- a/include/hybbx/chess.h
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef HYBBX_CHESS_H
-#define HYBBX_CHESS_H
-
-#include "hybbx/types.h"
-#include "hybbx/limits.h"
-#include "hybbx/storage.h"
-#include "hybbx/service.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define CHESS_BOARD_SIZE 8
-#define CHESS_SQ_MAX 4
-#define CHESS_MOVE_MAX 8
-#define CHESS_SAN_MAX 8
-#define CHESS_GAME_MAX 16 /* array upper bound */
-#define CHESS_SPECTATOR_MAX 32
-#define CHESS_REFRESH_SEC 15
-#define CHESS_DEFAULT_MAX 8 /* default active games if INI omits [chess] */
-
-#define CHESS_EMPTY '.'
-
-typedef enum {
- CHESS_COLOR_NONE = 0,
- CHESS_WHITE,
- CHESS_BLACK
-} chess_color_t;
-
-typedef enum {
- CHESS_RESULT_NONE = 0,
- CHESS_WHITE_WINS,
- CHESS_BLACK_WINS,
- CHESS_DRAW_STALEMATE,
- CHESS_DRAW_AGREEMENT
-} chess_result_t;
-
-typedef struct chess_board {
- char sq[CHESS_BOARD_SIZE][CHESS_BOARD_SIZE];
-} chess_board_t;
-
-typedef struct chess_game {
- int active;
- char white_name[HYBBX_USER_NAME_MAX];
- char black_name[HYBBX_USER_NAME_MAX];
- struct hybbx_session *white_session;
- struct hybbx_session *black_session;
- struct hybbx_session *spectators[CHESS_SPECTATOR_MAX];
- unsigned spectator_count;
- chess_board_t board;
- chess_color_t turn;
- unsigned move_number;
- chess_result_t result;
- char last_move_san[CHESS_SAN_MAX];
- unsigned tick_counter;
- char game_id[8];
-} chess_game_t;
-
-void hybbx_chess_init(void);
-void hybbx_chess_shutdown(void);
-void hybbx_chess_config_apply(const struct hybbx_config *config);
-unsigned hybbx_chess_max_games(void);
-void hybbx_chess_shutdown(void);
-
-chess_game_t *hybbx_chess_create_game(struct hybbx_session *white,
- const char *white_name);
-chess_game_t *hybbx_chess_find_open_game(void);
-chess_game_t *hybbx_chess_find_game_by_id(const char *id);
-chess_game_t *hybbx_chess_get_game(unsigned index);
-int hybbx_chess_join_game(chess_game_t *game,
- struct hybbx_session *black,
- const char *black_name);
-int hybbx_chess_add_spectator(chess_game_t *game,
- struct hybbx_session *spec);
-void hybbx_chess_remove_spectator(chess_game_t *game,
- struct hybbx_session *spec);
-int hybbx_chess_is_player(const chess_game_t *game,
- const struct hybbx_session *session);
-int hybbx_chess_is_spectator(const chess_game_t *game,
- const struct hybbx_session *session);
-chess_color_t hybbx_chess_player_color(const chess_game_t *game,
- const struct hybbx_session *session);
-int hybbx_chess_make_move(chess_game_t *game,
- const char *from, const char *to,
- char promote, char *err, size_t errlen);
-void hybbx_chess_render_board(const chess_board_t *board,
- struct hybbx_session *session,
- const char *label);
-void hybbx_chess_send_board(chess_game_t *game,
- struct hybbx_session *session);
-void hybbx_chess_tick(struct hybbx_service *service);
-void hybbx_chess_resign(chess_game_t *game,
- struct hybbx_session *who);
-void hybbx_chess_offer_draw(chess_game_t *game,
- struct hybbx_session *who);
-
-/* Command handler - called from command.c dispatch */
-hybbx_result_t cmd_chess(struct hybbx_service *service,
- struct hybbx_session *session,
- const struct hybbx_parsed_command *cmd);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* HYBBX_CHESS_H */
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com