diff --git a/DataModels/GC.py b/DataModels/GC.py index d037f38..52f3a88 100644 --- a/DataModels/GC.py +++ b/DataModels/GC.py @@ -53,33 +53,6 @@ class GC(Cell): self.moves.extend(result) self.moves.reverse() - """def find_houses_BestFS(self,enviromnent, house_count): - x = self.x - y = self.y - result = [] - - houses_list = [] - dump_list = [] - a = 0 - for row in enviromnent: - b = 0 - for col in row: - print(col) - if (type(col) is House): - houses_list.append([col,[a,b]]) - if (type(col) is Dump): - dump_list.append([col,[a,b]]) - b += 1 - a += 1 - - available_movement = check_moves(enviromnent, x, y) - result, [x, y] = BestFS(enviromnent, [[x, y]], houses_list) - self.moves.extend(result) - available_movement = check_moves(enviromnent, x, y) - result, [x, y] = BestFS(enviromnent, [[x, y]], dump_list) - print("IM ALIVEEEEEEEEEEEEEEEE") - self.moves.extend(result[1:]) - self.moves.reverse()""" def find_houses_BestFS(self, environment): x = self.x diff --git a/Traversal/BestFS.py b/Traversal/BestFS.py index 4740d87..5bfc44a 100644 --- a/Traversal/BestFS.py +++ b/Traversal/BestFS.py @@ -20,12 +20,10 @@ def BestFS(grid, available_movement, gc_moveset, object_list, depth = 0): #calculate distance to the nearest object min_distance_goal = CalculateDistance([x,y], object_list) - print(depth,min_distance_goal) if(min_distance_goal[1] == 1): gc_moveset.append("pick_garbage") cell = grid[min_distance_goal[0][0]][min_distance_goal[0][1]] - print("***"+str([cell,min_distance_goal[0]])+"***") object_list.remove([cell,min_distance_goal[0]]) return([x, y], gc_moveset, object_list) @@ -49,10 +47,6 @@ def BestFS(grid, available_movement, gc_moveset, object_list, depth = 0): if(len(preffered_directions) == 1): discouraged_directions.append(movement(grid, x, y)[1][preffered_directions[0]]) - """print("Preferred: "+str(preffered_directions)) - print("Discouraged: "+str(discouraged_directions)) - print("Available: "+str(available_movement))""" - #sort available moves according to preferences sorted = [o for o in preffered_directions if o in available_movement] for o in sorted: @@ -64,16 +58,11 @@ def BestFS(grid, available_movement, gc_moveset, object_list, depth = 0): sorted.extend(available_movement) available_movement = sorted.copy() - print("After sorting: "+str(available_movement)) - for direction in available_movement: - print("HH") - print(depth,direction) x_next, y_next = movement(grid,x,y)[0][direction] available_movement_next = check_moves(grid, x_next,y_next,direction) gc_moveset_next = gc_moveset.copy() gc_moveset_next.append([x_next,y_next]) result = BestFS(grid, available_movement_next, gc_moveset_next, object_list, depth + 1) - print(type(result)) if result!= None: return result \ No newline at end of file