SI_2020/agent.py

29 lines
746 B
Python
Raw Normal View History

2020-04-02 15:25:15 +02:00
class Agent:
def __init__(self, start_x, start_y, assigned_warehouse, radius=5):
2020-04-02 15:25:15 +02:00
self.x = start_x
self.y = start_y
self.radius = radius
self.assigned_warehouse = assigned_warehouse
self.is_loaded = False
def move_right(self):
self.x += 1
if self.x > self.assigned_warehouse.width - 1:
self.x = self.assigned_warehouse.width - 1
def move_left(self):
self.x -= 1
if self.x < 0:
self.x = 0
def move_down(self):
self.y += 1
if self.y > self.assigned_warehouse.height - 1:
self.y = self.assigned_warehouse.height - 1
def move_up(self):
self.y -= 1
if self.y < 0:
self.y = 0