From 6fbd5c76d04094f92abfac52e679aeac9cedf0c4 Mon Sep 17 00:00:00 2001 From: Anna Nowak Date: Tue, 4 Jun 2019 23:26:26 +0200 Subject: [PATCH] Naprawiono bledy z rozwiazywania konfliktow --- DataModels/GC.py | 23 ++--------------------- utilities.py | 12 +----------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/DataModels/GC.py b/DataModels/GC.py index e4210cf..b5f6bad 100644 --- a/DataModels/GC.py +++ b/DataModels/GC.py @@ -2,14 +2,9 @@ from DataModels.Cell import Cell from DataModels.Road import Road from DataModels.House import House from DataModels.Dump import Dump -<<<<<<< Updated upstream from config import GRID_WIDTH, GRID_HEIGHT, DELAY, CLOSE_ON_END from utilities import movement, check_moves, save_moveset from vowpal_utils import parse_list, MAP_CONTENT -======= -from config import GRID_WIDTH, GRID_HEIGHT, DELAY -from utilities import movement, check_moves, parse_list ->>>>>>> Stashed changes from Traversal.DFS import DFS from Traversal.BestFS import BestFS from Traversal.BFS import BFS @@ -63,11 +58,7 @@ class GC(Cell): house,[x,y],result = DFS(enviromnent,avalible_moves,[[x,y]],House) elif mode == "BFS": house,[x,y],result = BFS(enviromnent,avalible_moves,[[x,y]],House) -<<<<<<< Updated upstream self.moves.extend(parse_list(result[1:], last_x,last_y)) -======= - whole_result.extend(result) ->>>>>>> Stashed changes element_list.append(house) MAP_CONTENT[house.y][house.x] = 'V' @@ -79,16 +70,10 @@ class GC(Cell): dump,[x,y],result = DFS(enviromnent,avalible_moves,[[x,y]],Dump) elif mode == "BFS": dump,[x,y],result = BFS(enviromnent,avalible_moves,[[x,y]],Dump) -<<<<<<< Updated upstream self.moves.extend(parse_list(result[1:], last_x,last_y)) element_list.append(dump) -======= - whole_result.extend(result) - element_list.append(dump) - self.moves.extend(parse_list(element_list)) for x in element_list: x.unvisited = True ->>>>>>> Stashed changes self.moves.reverse() save_moveset(self.moves) @@ -148,9 +133,5 @@ class GC(Cell): self.collect(environment) self.moves.pop() return -<<<<<<< Updated upstream - self.move(self.moves[-1],environment) - self.moves.pop() -======= - move(self.moves.pop(),enviromnent) ->>>>>>> Stashed changes + direction = self.moves.pop() + self.move(direction,environment) diff --git a/utilities.py b/utilities.py index c7e33ee..c402af1 100644 --- a/utilities.py +++ b/utilities.py @@ -23,7 +23,7 @@ def check_moves(environment, x,y,direction=None): return ([dir for dir in movement(environment, x, y)[0] if movement(environment, x,y)[0][dir] != (x,y)]) return ([dir for dir in movement(environment, x, y)[0] if movement(environment, x,y)[0][dir] != (x,y) and dir != movement(environment,x,y)[1][direction]]) -<<<<<<< Updated upstream + def save_moveset(moveset): if platform.system() == 'Windows': path = '\moveset_data.json' @@ -51,13 +51,3 @@ def save_moveset(moveset): f.seek(0) json.dump(results, f, indent=1) f.close() -======= -def parse_list(whole_result): - moves = [] - parser = {[0,1]:"up",[0,-1]:"down",[1,0]:"right",[-1,0]:"left"} - for x in len(whole_result)-1: - x_subtraction = whole_result[x+1][0]-whole_result[x][0] - y_subtraction = whole_result[x+1][1]-whole_result[x][1] - moves.append(parser[[x_subtraction,y_subtraction]]) - return moves ->>>>>>> Stashed changes