From: Stephen Seo Date: Mon, 7 Mar 2022 04:12:05 +0000 (+0900) Subject: Set up API for AI choice of slot on board X-Git-Tag: sprint_02_day_1~11 X-Git-Url: https://git.seodisparate.com/stephenseo/static/git-favicon.png?a=commitdiff_plain;h=2e58bc128827205884ebc75988cc7d41d48e47de;p=EN605.607.81.SP22_ASDM_Project Set up API for AI choice of slot on board --- diff --git a/front_end/src/ai/mod.rs b/front_end/src/ai/mod.rs new file mode 100644 index 0000000..6cbb07e --- /dev/null +++ b/front_end/src/ai/mod.rs @@ -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 { + Err("Unimplemented".into()) +} diff --git a/front_end/src/main.rs b/front_end/src/main.rs index c99ae5b..3893bcd 100644 --- a/front_end/src/main.rs +++ b/front_end/src/main.rs @@ -1,6 +1,7 @@ mod constants; mod state; mod yew_components; +mod ai; use state::SharedState; use yew::prelude::*; diff --git a/front_end/src/state.rs b/front_end/src/state.rs index 82780e2..6bb693b 100644 --- a/front_end/src/state.rs +++ b/front_end/src/state.rs @@ -95,9 +95,11 @@ impl Turn { } } +pub type BoardType = [Rc>; 56]; + #[derive(Clone, Debug, PartialEq)] pub struct SharedState { - pub board: [Rc>; 56], + pub board: BoardType, pub game_state: Rc>, pub turn: Rc>, }