]> git.seodisparate.com - EN605.607.81.SP22_ASDM_Project/commitdiff
Set up API for AI choice of slot on board
authorStephen Seo <seo.disparate@gmail.com>
Mon, 7 Mar 2022 04:12:05 +0000 (13:12 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Mon, 7 Mar 2022 04:12:05 +0000 (13:12 +0900)
front_end/src/ai/mod.rs [new file with mode: 0644]
front_end/src/main.rs
front_end/src/state.rs

diff --git a/front_end/src/ai/mod.rs b/front_end/src/ai/mod.rs
new file mode 100644 (file)
index 0000000..6cbb07e
--- /dev/null
@@ -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())
+}
index c99ae5bc54217f8be297a970cb51e5acd2c1bac5..3893bcdc79e65bd5eaf1c62e5e45bb02d933ec6b 100644 (file)
@@ -1,6 +1,7 @@
 mod constants;
 mod state;
 mod yew_components;
+mod ai;
 
 use state::SharedState;
 use yew::prelude::*;
index 82780e26675fbddbc523524f1e9b585d2eed677d..6bb693b7ec99e34430c5e17f4a1900107a966d0d 100644 (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>>,
 }