Projekt_AI-Automatyczny_saper/Engine/Agent.py

20 lines
615 B
Python
Raw Normal View History

2021-03-15 19:04:51 +01:00
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