2019-04-01 13:29:13 +02:00
|
|
|
from DataModels.Cell import Cell
|
2019-04-01 14:10:14 +02:00
|
|
|
from DataModels.Road import Road
|
2019-04-01 13:29:13 +02:00
|
|
|
|
2019-04-01 14:10:14 +02:00
|
|
|
|
|
|
|
class GC(Cell):
|
|
|
|
def __init__(self, x, y, max_rubbish, yellow=0, green=0, blue=0):
|
|
|
|
Cell.__init__(self, x, y, max_rubbish, yellow, green, blue)
|
|
|
|
|
|
|
|
def move(self, direction, environment):
|
|
|
|
x, y = [self.x, self.y]
|
|
|
|
movement = {
|
|
|
|
"right": (x + 1, y) if environment[x + 1][y] == Road else (x, y),
|
|
|
|
"left": (x - 1, y) if environment[x - 1][y] == Road else (x, y),
|
|
|
|
"up": (x, y + 1) if environment[x][y + 1] == Road else (x, y),
|
|
|
|
"down": (x, y - 1) if environment[x][y - 1] == Road else (x, y)
|
|
|
|
}
|
|
|
|
self.x, self.y = movement[direction]
|
|
|
|
print(self.x, self.y)
|