Fixed autoshut

This commit is contained in:
Magdalena Wilczyńska 2019-05-30 20:23:56 +02:00
parent 635292d9f5
commit 94064f5d03

View File

@ -11,6 +11,7 @@ import pygame, sys
class GC(Cell):
moves_made = 0
algorithm_run = False
def __init__(self, x, y, max_rubbish, yellow=0, green=0, blue=0):
Cell.__init__(self, x, y, max_rubbish, yellow, green, blue)
self.moves = []
@ -41,6 +42,8 @@ class GC(Cell):
return self.moves_made
def find_houses(self,enviromnent, house_count,dump_count, mode):
self.algorithm_run = True
x = self.x
y = self.y
result = []
@ -71,6 +74,8 @@ class GC(Cell):
def find_houses_BestFS(self, environment):
self.algorithm_run = True
x = self.x
y = self.y
result = [[x,y]]
@ -109,7 +114,7 @@ class GC(Cell):
def make_actions_from_list(self,environment):
now = pygame.time.get_ticks()
if len(self.moves)==0 or now - self.old_time <= DELAY:
if(len(self.moves)==0 and CLOSE_ON_END):
if(len(self.moves)==0 and CLOSE_ON_END=="true" and self.algorithm_run):
print("DONE")
sys.exit()
return