pub struct AlgorithmRebornState {
pub action_frequency: HashMap<PlayerActionType, u32>,
pub markov_transitions: HashMap<(PlayerActionType, PlayerActionType), u32>,
pub last_action: Option<PlayerActionType>,
pub predicted_action: Option<PlayerActionType>,
pub counter_mode: bool,
pub markov_mode: bool,
pub degradation: f32,
pub hidden_hp_frac: f32,
}Expand description
State for the Algorithm Reborn Boss. Phase 1: learns player patterns (tracks action frequency). Phase 2: counters player’s most-used action type. Phase 3: predicts next action via Markov chain. Unique: no HP bar shown.
Fields§
§action_frequency: HashMap<PlayerActionType, u32>Frequency count of each player action type.
markov_transitions: HashMap<(PlayerActionType, PlayerActionType), u32>Markov chain: transition probabilities from action A to action B. Key: (from_action, to_action), Value: count.
last_action: Option<PlayerActionType>Last player action (for Markov chain).
predicted_action: Option<PlayerActionType>The predicted next player action (phase 3).
counter_mode: boolWhether the boss is in counter mode (phase 2+).
markov_mode: boolWhether Markov prediction is active (phase 3).
degradation: f32Visual degradation level [0, 1]. 0 = pristine, 1 = nearly dead.
Actual HP fraction (hidden from player).
Implementations§
Source§impl AlgorithmRebornState
impl AlgorithmRebornState
pub fn new() -> Self
Sourcepub fn record_action(&mut self, action: PlayerActionType)
pub fn record_action(&mut self, action: PlayerActionType)
Record a player action and update the frequency and Markov tables.
Sourcepub fn most_used_action(&self) -> Option<PlayerActionType>
pub fn most_used_action(&self) -> Option<PlayerActionType>
Get the player’s most frequently used action.
Sourcepub fn counter_for(action: &PlayerActionType) -> PlayerActionType
pub fn counter_for(action: &PlayerActionType) -> PlayerActionType
Get the counter-action for a given player action.
Sourcepub fn predict_next(&mut self) -> Option<PlayerActionType>
pub fn predict_next(&mut self) -> Option<PlayerActionType>
Predict the next player action using the Markov chain.
Sourcepub fn update_degradation(&mut self, hp_frac: f32)
pub fn update_degradation(&mut self, hp_frac: f32)
Update visual degradation based on actual HP fraction.
Sourcepub fn enter_phase2(&mut self)
pub fn enter_phase2(&mut self)
Enter phase 2: enable counter mode.
Sourcepub fn enter_phase3(&mut self)
pub fn enter_phase3(&mut self)
Enter phase 3: enable Markov prediction.
Trait Implementations§
Source§impl Clone for AlgorithmRebornState
impl Clone for AlgorithmRebornState
Source§fn clone(&self) -> AlgorithmRebornState
fn clone(&self) -> AlgorithmRebornState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more