pub struct AdaptiveAI {
pub brain: AIBrain,
pub difficulty: f32,
pub adaptation_rate: f32,
/* private fields */
}Expand description
Adaptive AI that blends optimal and random actions based on difficulty.
Fields§
§brain: AIBrain§difficulty: f32Difficulty in [0, 1]. 0 = fully random, 1 = fully optimal.
adaptation_rate: f32Implementations§
Source§impl AdaptiveAI
impl AdaptiveAI
pub fn new(state_dim: usize, difficulty: f32) -> Self
Sourcepub fn select_action(&self, state: &GameState) -> Action
pub fn select_action(&self, state: &GameState) -> Action
Select an action, blending optimal with random based on difficulty.
Sourcepub fn update_difficulty(&mut self, player_won: bool)
pub fn update_difficulty(&mut self, player_won: bool)
Update difficulty based on whether the player won or lost the last encounter.
player_won: true if player won.
Auto Trait Implementations§
impl Freeze for AdaptiveAI
impl RefUnwindSafe for AdaptiveAI
impl Send for AdaptiveAI
impl Sync for AdaptiveAI
impl Unpin for AdaptiveAI
impl UnsafeUnpin for AdaptiveAI
impl UnwindSafe for AdaptiveAI
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.