From 2e58bc128827205884ebc75988cc7d41d48e47de Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 7 Mar 2022 13:12:05 +0900 Subject: [PATCH] Set up API for AI choice of slot on board --- front_end/src/ai/mod.rs | 23 +++++++++++++++++++++++ front_end/src/main.rs | 1 + front_end/src/state.rs | 4 +++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 front_end/src/ai/mod.rs 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>, }