2020-04-03 20:42:23 +02:00
|
|
|
# TILE
|
|
|
|
class Tile:
|
2020-04-24 16:14:58 +02:00
|
|
|
def __init__(self, type_, x, y):
|
2020-04-03 20:42:23 +02:00
|
|
|
self.type = type_
|
2020-04-06 22:10:21 +02:00
|
|
|
|
|
|
|
if self.type == 'wall':
|
|
|
|
self.watch_through = 0
|
|
|
|
self.walk_through = 0
|
2020-04-27 21:56:17 +02:00
|
|
|
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':
|
2020-04-06 22:10:21 +02:00
|
|
|
self.watch_through = 1
|
|
|
|
self.walk_through = 0
|
|
|
|
else:
|
|
|
|
self.walk_through = 1
|
|
|
|
self.watch_through = 1
|
|
|
|
|
|
|
|
self.action_required = 0
|
|
|
|
|
2020-04-24 16:14:58 +02:00
|
|
|
# Atrybuty niezbedne dla A*
|
|
|
|
self.position = (x, y)
|
|
|
|
self.parent = None
|
2020-04-26 14:14:35 +02:00
|
|
|
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
|
2020-04-24 16:14:58 +02:00
|
|
|
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
|