def execute(self, agent: Agent, state: SimState) -> None: if agent.state() is not AgentState.INFECTIVE: return if np.random.random() < state.remove_prob(): agent.set_state(AgentState.REMOVED) else: agent.update_sick_days()
def execute(self, agent: Agent, state: SimState) -> None: """Basically the same method as in the DefaultStatusStrategy, but adding the lethality check. :param agent Agent to update :param state State the simulation is in""" if agent.state() is not AgentState.INFECTIVE: return if np.random.random() < state.remove_prob(): if np.random.random() < state.lethality(): agent.set_state(AgentState.DEAD) else: agent.set_state(AgentState.IMMUNE) else: agent.update_sick_days()