From 94064f5d03cb6b83373fc0c767e243e192edab09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Wilczy=C5=84ska?= Date: Thu, 30 May 2019 20:23:56 +0200 Subject: [PATCH] Fixed autoshut --- DataModels/GC.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/DataModels/GC.py b/DataModels/GC.py index 5d395b8..35638a1 100644 --- a/DataModels/GC.py +++ b/DataModels/GC.py @@ -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