32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
# TILE
|
|
class Tile:
|
|
def __init__(self, type_, x, y):
|
|
self.type = type_
|
|
|
|
if self.type == 'wall':
|
|
self.watch_through = 0
|
|
self.walk_through = 0
|
|
elif self.type == 'table' or self.type == 'bar' or self.type == 'chair_front' or self.type == 'chair_back' or self.type == 'chair_left' or self.type == 'chair_right':
|
|
self.watch_through = 1
|
|
self.walk_through = 0
|
|
else:
|
|
self.walk_through = 1
|
|
self.watch_through = 1
|
|
|
|
self.action_required = 0
|
|
|
|
# Atrybuty niezbedne dla A*
|
|
self.position = (x, y)
|
|
self.parent = None
|
|
self.totalCost = 0 # Koszt totalny czyli dystans do wierzcholka startowego + heurystyka F
|
|
self.startCost = 0 # Dystans do wierzcholka startowego G
|
|
# Dystant do wierzcholka koncowego oszacowany za pomoca funkcji heurystyki H
|
|
self.heuristic = 0
|
|
|
|
# Operator porownywania pol
|
|
def __eq__(self, other):
|
|
return True if (self.position == other.position) else False
|
|
|
|
|
|
# dodanie atrybutu x i y do klasy Tile
|