feat: implement and exhaustively test the game domain core
This commit is contained in:
+22
-1
@@ -1,6 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "app_interfaces.h"
|
||||
#include "fleet_generator.h"
|
||||
#include "game_types.h"
|
||||
|
||||
/* Rule implementation begins in Milestone 007. */
|
||||
typedef struct { game_state_t state; } game_engine_t;
|
||||
|
||||
typedef uint8_t game_result_t;
|
||||
enum {
|
||||
GAME_RESULT_OK,
|
||||
GAME_RESULT_INVALID_COORDINATE,
|
||||
GAME_RESULT_WRONG_PHASE,
|
||||
GAME_RESULT_NOT_YOUR_TURN,
|
||||
GAME_RESULT_CELL_ALREADY_SHOT,
|
||||
GAME_RESULT_GENERATION_FAILED,
|
||||
};
|
||||
|
||||
typedef struct { bool hit; bool sunk; bool finished; } shot_result_t;
|
||||
|
||||
void game_engine_init(game_engine_t *engine);
|
||||
game_result_t game_engine_start(game_engine_t *engine, uint32_t game_id, game_mode_t mode,
|
||||
const fleet_generator_t *generator);
|
||||
game_result_t game_engine_shot(game_engine_t *engine, uint8_t player, coordinate_t coordinate,
|
||||
shot_result_t *result);
|
||||
|
||||
Reference in New Issue
Block a user