forked from Stanford-ILIAD/CARLO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
agents.py
57 lines (50 loc) · 2.25 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from entities import RectangleEntity, CircleEntity, RingEntity
from geometry import Point
# For colors, we use tkinter colors. See http://www.science.smith.edu/dftwiki/index.php/Color_Charts_for_TKinter
class Car(RectangleEntity):
def __init__(self, center: Point, heading: float, color: str = 'red'):
size = Point(4., 2.)
movable = True
friction = 0.06
super(Car, self).__init__(center, heading, size, movable, friction)
self.color = color
self.collidable = True
class Pedestrian(CircleEntity):
def __init__(self, center: Point, heading: float, color: str = 'LightSalmon3'): # after careful consideration, I decided my color is the same as a salmon, so here we go.
radius = 0.5
movable = True
friction = 0.2
super(Pedestrian, self).__init__(center, heading, radius, movable, friction)
self.color = color
self.collidable = True
class RectangleBuilding(RectangleEntity):
def __init__(self, center: Point, size: Point, color: str = 'gray26'):
heading = 0.
movable = False
friction = 0.
super(RectangleBuilding, self).__init__(center, heading, size, movable, friction)
self.color = color
self.collidable = True
class CircleBuilding(CircleEntity):
def __init__(self, center: Point, radius: float, color: str = 'gray26'):
heading = 0.
movable = False
friction = 0.
super(CircleBuilding, self).__init__(center, heading, radius, movable, friction)
self.color = color
self.collidable = True
class RingBuilding(RingEntity):
def __init__(self, center: Point, inner_radius: float, outer_radius: float, color: str = 'gray26'):
heading = 0.
movable = False
friction = 0.
super(RingBuilding, self).__init__(center, heading, inner_radius, outer_radius, movable, friction)
self.color = color
self.collidable = True
class Painting(RectangleEntity):
def __init__(self, center: Point, size: Point, color: str = 'gray26', heading: float = 0.):
movable = False
friction = 0.
super(Painting, self).__init__(center, heading, size, movable, friction)
self.color = color
self.collidable = False