-
Notifications
You must be signed in to change notification settings - Fork 8
/
mesa_agents.py
39 lines (28 loc) · 889 Bytes
/
mesa_agents.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
Created on Sat Mar 09 16:35:24 2020
@author: Pieter Cawood
"""
from mesa import Agent
class Robot(Agent):
def __init__(self, pos, model, path):
super().__init__(pos, model)
self.pos = pos
self.path = path
def step(self):
# Move robot
if self.model.time_step in self.path:
self.model.grid.remove_agent(self)
self.pos = ((self.path[self.model.time_step]).col, (self.path[self.model.time_step]).row)
self.model.grid.place_agent(self, self.pos)
class Wall(Agent):
def __init__(self, pos, model):
super().__init__(pos, model)
self.pos = pos
class Parking(Agent):
def __init__(self, pos, model):
super().__init__(pos, model)
self.pos = pos
class Space(Agent):
def __init__(self, pos, model):
super().__init__(pos, model)
self.pos = pos