20 lines
615 B
Python
20 lines
615 B
Python
|
from Constants import ROWS, COLS, UP, LEFT, DOWN, RIGHT
|
||
|
class Agent(object):
|
||
|
def __init__(self, column, row):
|
||
|
self.column = column
|
||
|
self.row = row
|
||
|
|
||
|
def ifNotOnEdge(self, destination):
|
||
|
if destination == UP:
|
||
|
if self.row - 1 <= 0:
|
||
|
return False
|
||
|
if destination == DOWN:
|
||
|
if self.row + 1 > ROWS:
|
||
|
return False
|
||
|
if destination == LEFT:
|
||
|
if self.column - 1 <= 0:
|
||
|
return False
|
||
|
if destination == RIGHT:
|
||
|
if self.column + 1 > COLS:
|
||
|
return False
|
||
|
return True
|