mirror of
https://github.com/balkian/gists.git
synced 2024-11-21 17:22:29 +00:00
Add 'repos/887c5b163f5359a6a13a7858e7f484d4/' from commit 'b259496b2279a15887ceff85cab75a5072845905'
git-subtree-dir: repos/887c5b163f5359a6a13a7858e7f484d4 git-subtree-mainline:8ec0a8ee90
git-subtree-split:b259496b22
This commit is contained in:
commit
49aeda804b
17
repos/887c5b163f5359a6a13a7858e7f484d4/prueba.py
Normal file
17
repos/887c5b163f5359a6a13a7858e7f484d4/prueba.py
Normal file
@ -0,0 +1,17 @@
|
||||
NEUTRAL = 0
|
||||
INFECTED = 1
|
||||
|
||||
class ControlModelM2(BaseBehaviour):
|
||||
NEUTRAL = 0
|
||||
INFECTED = 1
|
||||
def step(self, now):
|
||||
if self.state['id'] == NEUTRAL:
|
||||
self.neutral_behaviour()
|
||||
elif self.state['id'] == INFECTED:
|
||||
self.infected_behaviour()
|
||||
…
|
||||
def infected_behaviour(self):
|
||||
neutral_neighbors = self.get_neighboring_agents(state_id=INFECTED)
|
||||
for neighbor in neutral_neighbors:
|
||||
if random.random() < self.prob_infect:
|
||||
neighbor.state['id'] = INFECTED
|
Loading…
Reference in New Issue
Block a user