http: make_move demo

This commit is contained in:
2024-01-30 21:03:38 +01:00
parent f5820656c3
commit 1368c97ab3
2 changed files with 36 additions and 7 deletions

View File

@@ -216,7 +216,7 @@ impl GameState {
/// After scoring, either ends the game and calculates bonus
/// or fills the factories again and sets the starting player
/// Also tracks rounds and days
fn do_iter(&mut self, game_move: GameMove) -> Result<(), MoveErr> {
pub fn do_iter(&mut self, game_move: GameMove) -> Result<(), MoveErr> {
if self.game_end {
return Err(MoveErr::Other("Game is over"));
}
@@ -377,7 +377,7 @@ impl GameState {
}
}
enum MoveErr {
pub enum MoveErr {
Player(&'static str),
Color(&'static str),
Src(&'static str),
@@ -793,7 +793,7 @@ type Row = [bool; 5];
type Wall = [Row; 5];
#[derive(Serialize, Deserialize, Clone, Copy)]
struct GameMove {
pub struct GameMove {
player: usize, // Safeguard to check that the bot knows which player it is
policy: Policy, // What policy to run moves under, so bots can do less error-handling
color: Color, // What color to select