Set up API for AI choice of slot on board

This commit is contained in:
Stephen Seo 2022-03-07 13:12:05 +09:00
parent 614aae9f54
commit 2e58bc1288
3 changed files with 27 additions and 1 deletions

23
front_end/src/ai/mod.rs Normal file
View file

@ -0,0 +1,23 @@
use crate::state::BoardType;
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum AIDifficulty {
Easy,
Normal,
Hard,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum SlotChoice {
Slot0,
Slot1,
Slot2,
Slot3,
Slot4,
Slot5,
Slot6,
}
pub fn get_ai_choice(difficulty: AIDifficulty, board: &BoardType) -> Result<SlotChoice, String> {
Err("Unimplemented".into())
}

View file

@ -1,6 +1,7 @@
mod constants;
mod state;
mod yew_components;
mod ai;
use state::SharedState;
use yew::prelude::*;

View file

@ -95,9 +95,11 @@ impl Turn {
}
}
pub type BoardType = [Rc<Cell<BoardState>>; 56];
#[derive(Clone, Debug, PartialEq)]
pub struct SharedState {
pub board: [Rc<Cell<BoardState>>; 56],
pub board: BoardType,
pub game_state: Rc<Cell<GameState>>,
pub turn: Rc<Cell<Turn>>,
}