feat: complete human-vs-ESP32 gameplay and cumulative statistics

This commit is contained in:
2026-08-29 23:33:27 +03:00
parent 650ade2726
commit c8e0c9168b
14 changed files with 269 additions and 19 deletions
+5
View File
@@ -1,6 +1,7 @@
#pragma once
#include "fleet_generator.h"
#include "bot_player.h"
#include "game_engine.h"
#include "session_manager.h"
#include "statistics.h"
@@ -28,12 +29,15 @@ typedef struct {
session_manager_t sessions;
cumulative_statistics_t cumulative[kPlayerCapacity];
random_source_t random;
bot_player_t bot;
scheduler_t bot_scheduler;
bool bot_reserved;
bool rematch_confirmed[kPlayerCapacity];
uint32_t next_game_id;
} game_lifecycle_t;
void game_lifecycle_init(game_lifecycle_t *lifecycle, random_source_t random);
void game_lifecycle_set_bot_scheduler(game_lifecycle_t *lifecycle, scheduler_t scheduler);
lifecycle_result_t game_lifecycle_join(game_lifecycle_t *lifecycle, role_t requested_role, const char *name,
uint8_t *session_index);
lifecycle_result_t game_lifecycle_resume(game_lifecycle_t *lifecycle,
@@ -47,5 +51,6 @@ lifecycle_result_t game_lifecycle_shot(game_lifecycle_t *lifecycle, uint8_t sess
coordinate_t coordinate, shot_result_t *result);
lifecycle_result_t game_lifecycle_rematch(game_lifecycle_t *lifecycle, uint8_t session_index, uint32_t game_id);
lifecycle_result_t game_lifecycle_abort(game_lifecycle_t *lifecycle, uint8_t session_index, uint32_t game_id);
bool game_lifecycle_bot_take_turn(game_lifecycle_t *lifecycle);
_Static_assert(sizeof(game_lifecycle_t) <= 1600, "lifecycle state grew beyond fixed budget");