use std::sync::{ atomic::{AtomicU32, Ordering::SeqCst}, Arc, Mutex, MutexGuard, }; use anyhow::Result; use assetpath::AssetPath; use engine::prelude::{cgmath::vec3, *}; use crate::{ board::{Board, BoardSlot, BoardSlotState}, objects::Objects, simple_ai::SimpleAI, }; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub enum StoneState { ReadyToBePlaced, Placed, Dead, } pub struct Stone { pub stone: Entity, pub state: StoneState, } #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub enum GameState { Placing, Removing, Main, } #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub enum PlayerColor { White, Black, } #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub enum MillState { White, Black, None, } impl PlayerColor { pub fn swap(&mut self) { *self = match *self { PlayerColor::White => { MillGame::log("swapped to black player"); PlayerColor::Black } PlayerColor::Black => { MillGame::log("swapped to white player"); PlayerColor::White } } } } pub struct MillGame { board: Arc>, white_stones: Mutex<[Stone; 9]>, black_stones: Mutex<[Stone; 9]>, state: Mutex, current_player: Mutex, scene: Mutex, camera_controls: Mutex, mouse_x: AtomicU32, mouse_y: AtomicU32, simple_ai: SimpleAI, white_player_label: Arc