Merge branch 'VowpalWabbit' of https://git.wmi.amu.edu.pl/s440556/SZI2019SmieciarzWmi into VowpalWabbit

This commit is contained in:
Anna Nowak 2019-05-30 21:37:03 +02:00
commit c969355d70

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 = []
@ -20,7 +21,7 @@ class GC(Cell):
self.x, self.y = movement(environment, self.x, self.y)[0][direction]
self.update_rect(self.x, self.y)
self.moves_made = self.moves_made + 1 #moves counter
def collect(self, enviromnent):
x, y = [self.x, self.y]
coordinates = [(x, y - 1), (x, y + 1), (x - 1, y), (x + 1, y)]
@ -40,6 +41,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
whole_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]]
@ -110,9 +115,9 @@ 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):
# print("DONE")
# sys.exit()
if(len(self.moves)==0 and CLOSE_ON_END=="true" and self.algorithm_run):
print("DONE")
sys.exit()
return
self.old_time = pygame.time.get_ticks()