use crate::prelude::*; pub(crate) struct AiPlugin; impl Plugin for AiPlugin { fn build(&self, app: &mut App) { app.init_state::() .init_resource::() .init_state::() // Bogo AI Systems .add_systems( Update, ( bogo_ai_thinking .run_if(in_state(AiDrama::Thinking)), bogo_ai_holding .run_if(in_state(AiDrama::Holding)), ) .run_if(in_state(PlayState::AiBogo)) .run_if(in_state(GameState::Play)) .run_if(in_state(TurnState(Side::A))) ); } } #[derive(Debug, States, Hash, Default, PartialEq, Eq, Clone, Component)] pub(crate) enum PlayState { Human, #[default] AiBogo, } #[derive(Debug, States, Hash, Default, PartialEq, Eq, Clone)] enum AiDrama { // Before AI picks up a piece #[default] Thinking, // When AI picks up piece Holding, } /// The move the AI will commit #[derive(Debug, Resource, Default)] struct AiMove(Move); // Bogo AI logic fn bogo_ai_thinking( board: Res, query: Query<(Entity, &BoardIndex), With>, time: Res