feat: implement the ESP32 opponent
This commit is contained in:
+22
-2
@@ -1,5 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "app_interfaces.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct { random_source_t random; scheduler_t scheduler; } bot_player_t;
|
||||
#include "app_interfaces.h"
|
||||
#include "game_types.h"
|
||||
|
||||
typedef uint8_t bot_cell_t;
|
||||
enum { BOT_CELL_UNKNOWN, BOT_CELL_MISS, BOT_CELL_HIT, BOT_CELL_BLOCKED };
|
||||
typedef struct { bool hit; bool sunk; } bot_shot_result_t;
|
||||
|
||||
typedef struct {
|
||||
random_source_t random;
|
||||
scheduler_t scheduler;
|
||||
bot_cell_t knowledge[kBotKnowledgeCellCount];
|
||||
bool turn_pending;
|
||||
} bot_player_t;
|
||||
|
||||
void bot_player_init(bot_player_t *bot, random_source_t random, scheduler_t scheduler);
|
||||
bool bot_player_next_shot(bot_player_t *bot, coordinate_t *coordinate);
|
||||
void bot_player_record_result(bot_player_t *bot, coordinate_t coordinate, const bot_shot_result_t *result);
|
||||
bool bot_player_schedule_turn(bot_player_t *bot);
|
||||
void bot_player_cancel_turn(bot_player_t *bot);
|
||||
|
||||
_Static_assert(sizeof(bot_player_t) <= 160, "bot state grew beyond fixed budget");
|
||||
|
||||
Reference in New Issue
Block a user