From 657173388219c823edf1031b9c205a0a98f2cfea Mon Sep 17 00:00:00 2001 From: trzmielewskiR Date: Thu, 7 Apr 2022 19:40:39 +0200 Subject: [PATCH 1/5] bfs first try, self movement added --- .idea/.gitignore | 3 ++ .idea/WALL-E.iml | 8 +++++ .../inspectionProfiles/profiles_settings.xml | 6 ++++ .idea/misc.xml | 4 +++ .idea/modules.xml | 8 +++++ .idea/vcs.xml | 6 ++++ SearchBfs.py | 27 ++++++++++++++ agent.py | 35 +++++++++++++------ mapa.py | 10 +++--- 9 files changed, 90 insertions(+), 17 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/WALL-E.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 SearchBfs.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/WALL-E.iml b/.idea/WALL-E.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/WALL-E.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d1e22ec --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..33d9c1a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SearchBfs.py b/SearchBfs.py new file mode 100644 index 0000000..dacecea --- /dev/null +++ b/SearchBfs.py @@ -0,0 +1,27 @@ +class BreadthSearchAlgorithm: + def __init__(self, graph, start, target): + self.graph = graph + self.start = start + self.target = target + + def bfs(self): + queue = [[self.start]] + visited = [] + + if self.start == self.target: + return + + while queue: + path = queue.pop(0) + node = path[-1] + if node not in visited: + neighbours = self.graph + for neighbour in neighbours: + next_path = list(path) + next_path.append(neighbour) + queue.append(next_path) + if neighbour == self.target: + return next_path + visited.append(node) + + return diff --git a/agent.py b/agent.py index 4adc04f..1aa106f 100644 --- a/agent.py +++ b/agent.py @@ -1,30 +1,43 @@ import pygame.image + class trashmaster(pygame.sprite.Sprite): - - def __init__(self,x,y,img): + + def __init__(self, x, y, img): super().__init__() - - self.width=x - self.height=y + + self.width = x + self.height = y self.x = 0 self.y = 0 - + self.image = pygame.image.load(img) - self.image = pygame.transform.scale(self.image, (self.width,self.height)) + self.image = pygame.transform.scale(self.image, (self.width, self.height)) self.rect = self.image.get_rect() def movement(self, key, vel): if key == pygame.K_LEFT: self.x -= vel - + if key == pygame.K_RIGHT: self.x += vel - + if key == pygame.K_UP: self.y -= vel - + if key == pygame.K_DOWN: self.y += vel - return (self.x, self.y) \ No newline at end of file + return (self.x, self.y) + + def move_up(self): + self.y -= 64 + + def move_down(self): + self.y += 64 + + def move_right(self): + self.x += 64 + + def move_left(self): + self.x -= 64 diff --git a/mapa.py b/mapa.py index ef58fb7..07581b1 100644 --- a/mapa.py +++ b/mapa.py @@ -2,7 +2,6 @@ import pygame as pg import pytmx - # config # TILE_SIZE = 16 @@ -16,15 +15,14 @@ import pytmx # return surface class TiledMap: - #loading file + # loading file def __init__(self, filename): tm = pytmx.load_pygame(filename, pixelalpha=True) self.width = tm.width * tm.tilewidth self.height = tm.height * tm.tileheight self.tmxdata = tm - - #rendering map + # rendering map def render(self, surface): ti = self.tmxdata.get_tile_image_by_gid for layer in self.tmxdata.visible_layers: @@ -33,8 +31,8 @@ class TiledMap: tile = ti(gid) if tile: surface.blit(tile, (x * self.tmxdata.tilewidth, y * self.tmxdata.tilewidth)) - + def make_map(self): temp_surface = pg.Surface((self.width, self.height)) self.render(temp_surface) - return temp_surface \ No newline at end of file + return temp_surface -- 2.20.1 From f41cf7e02bec447545145c2bbfe07079d32b52f9 Mon Sep 17 00:00:00 2001 From: trzmielewskiR Date: Thu, 7 Apr 2022 19:43:53 +0200 Subject: [PATCH 2/5] bfs search first try, self movement for agent added --- ok | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 ok diff --git a/ok b/ok new file mode 100644 index 0000000..9e2dcce --- /dev/null +++ b/ok @@ -0,0 +1,8 @@ +* bfsAlgorithm + master + remotes/origin/HEAD -> origin/master + remotes/origin/Mapa + remotes/origin/agent_movement + remotes/origin/bfsAlgorithm + remotes/origin/mapa2 + remotes/origin/master -- 2.20.1 From 3044a71592dbf77c86f390946039f4e6d3f15dd4 Mon Sep 17 00:00:00 2001 From: trzmielewskiR Date: Thu, 7 Apr 2022 21:37:51 +0200 Subject: [PATCH 3/5] bfs second try, adjacency matrix added, need to check if everything is correct --- SearchBfs.py | 2 +- data.txt | 30 ++++++++++++++++++++++++++ main.py | 60 ++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 data.txt diff --git a/SearchBfs.py b/SearchBfs.py index dacecea..f862837 100644 --- a/SearchBfs.py +++ b/SearchBfs.py @@ -24,4 +24,4 @@ class BreadthSearchAlgorithm: return next_path visited.append(node) - return + return "Path found" diff --git a/data.txt b/data.txt new file mode 100644 index 0000000..13f9675 --- /dev/null +++ b/data.txt @@ -0,0 +1,30 @@ +11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, +11,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,11, +11,0,0,0,0,0,0,0,0,0,35,0,0,0,0,0,0,0,0,0,2684354599,35,17,25,0,24,29,33,7,11, +11,7,0,0,23,0,17,14,12,0,13,0,16,13,0,24,0,42,13,25,0,45,22,29,0,44,0,0,7,11, +11,7,0,0,15,0,45,37,17,0,0,0,24,12,0,45,0,44,24,14,0,0,0,0,0,37,0,23,7,11, +11,7,0,0,13,0,0,0,41,25,0,20,16,41,22,35,0,29,37,21,0,17,42,0,0,25,0,0,7,11, +11,7,0,26,27,28,29,0,21,43,0,29,0,0,0,0,0,0,0,0,0,0,43,0,536870952,0,2684354599,0,7,11, +11,7,0,14,0,24,21,0,15,33,0,21,0,43,21,33,0,45,30,31,16,0,12,0,0,0,0,0,7,11, +11,7,0,42,0,22,20,0,0,0,0,44,0,20,40,16,0,43,0,33,13,0,45,0,17,0,43,0,7,11, +11,7,0,25,0,13,0,0,15,24,0,0,0,41,0,29,0,15,0,0,44,0,37,0,21,0,24,0,7,11, +11,7,0,0,0,0,0,33,29,0,17,12,0,21,0,0,0,17,43,0,13,29,41,0,24,0,13,0,7,11, +11,7,0,15,18,45,0,13,41,0,24,16,0,23,0,13,41,22,16,0,20,32,17,0,29,25,35,0,7,11, +11,7,0,25,35,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,0,0,0,0,0,0,0,7,11, +11,7,0,0,34,19,0,44,15,0,2684354596,2684354596,0,18,24,0,17,35,0,41,25,0,41,0,13,0,44,0,7,11, +11,7,24,0,0,0,0,0,0,0,0,0,0,42,20,0,16,0,0,0,24,0,21,0,18,0,25,0,7,9, +11,7,22,0,33,13,16,43,21,20,29,15,0,41,24,0,29,13,0,16,43,0,18,24,42,0,42,23,7,9, +11,7,21,0,21,20,0,0,0,0,41,44,0,42,15,0,0,0,0,0,0,0,0,0,0,0,0,0,7,9, +11,7,24,0,41,24,0,3221225510,1610612774,0,24,21,0,13,40,20,0,17,32,15,44,0,26,27,28,0,18,25,7,11, +11,7,18,0,44,12,0,2684354598,38,0,17,22,0,41,0,0,0,0,0,24,20,0,21,35,33,0,12,24,7,11, +11,7,13,0,0,0,0,0,0,0,0,0,0,12,15,21,0,13,35,18,41,37,43,39,15,0,22,18,7,11, +11,7,15,0,43,15,0,33,17,41,0,29,18,33,0,0,0,0,0,0,0,0,0,0,0,0,0,24,7,11, +11,7,13,0,25,0,0,0,0,39,21,42,44,14,0,18,45,0,13,14,0,29,0,42,13,0,25,35,7,11, +11,7,24,0,14,18,23,24,0,13,0,0,0,0,0,21,42,0,41,15,2684354599,21,0,15,0,0,0,24,7,11, +11,7,18,0,0,0,0,0,0,3221225508,0,21,15,0,41,29,0,0,0,0,43,14,18,42,0,14,0,18,7,11, +11,7,14,40,43,0,43,14,0,0,0,29,17,18,22,24,0,17,23,0,13,30,31,25,0,33,0,32,7,11, +11,7,14,0,44,0,12,0,0,24,14,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,15,7,11, +11,7,25,0,29,0,14,13,25,14,43,0,15,13,0,44,33,0,25,0,13,44,0,43,15,44,0,42,7,11, +11,7,23,0,0,0,0,0,0,0,0,0,32,45,0,35,25,0,0,0,0,0,0,32,0,0,0,18,7,11, +11,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,11, +11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11 \ No newline at end of file diff --git a/main.py b/main.py index 4dbbb4c..23a34da 100644 --- a/main.py +++ b/main.py @@ -1,21 +1,25 @@ import pygame as pg import sys from os import path + +import SearchBfs from map import * # from agent import trashmaster # from house import House from sprites import * from settings import * +from SearchBfs import * + class Game(): - + def __init__(self): pg.init() self.screen = pg.display.set_mode((WIDTH, HEIGHT)) pg.display.set_caption("Trashmaster") self.clock = pg.time.Clock() self.load_data() - + def load_data(self): game_folder = path.dirname(__file__) img_folder = path.join(game_folder, 'resources/textures') @@ -24,8 +28,8 @@ class Game(): self.map_img = self.map.make_map() self.map_rect = self.map_img.get_rect() - self.player_img = pg.image.load(path.join(img_folder,PLAYER_IMG)).convert_alpha() - self.player_img = pg.transform.scale(self.player_img, (PLAYER_WIDTH,PLAYER_HEIGHT) ) + self.player_img = pg.image.load(path.join(img_folder, PLAYER_IMG)).convert_alpha() + self.player_img = pg.transform.scale(self.player_img, (PLAYER_WIDTH, PLAYER_HEIGHT)) self.wall_img = pg.image.load(path.join(img_folder, WALL_IMG)).convert_alpha() self.wall_img = pg.transform.scale(self.wall_img, (TILESIZE, TILESIZE)) @@ -44,8 +48,8 @@ class Game(): # self.screen.blit(self.map_img, (0,0)) self.camera = Camera(self.map.width, self.map.height) self.draw_debug = False - - #self.screen.blit(self.map_img, self.camera.apply_rect(self.map_rect)) + + # self.screen.blit(self.map_img, self.camera.apply_rect(self.map_rect)) def run(self): # game loop - set self.playing = False to end the game @@ -55,7 +59,7 @@ class Game(): self.events() self.update() self.draw() - + def quit(self): pg.quit() sys.exit() @@ -65,14 +69,13 @@ class Game(): self.all_sprites.update() self.camera.update(self.player) # pygame.display.update() - + def draw_grid(self): for x in range(0, WIDTH, TILESIZE): pg.draw.line(self.screen, LIGHTGREY, (x, 0), (x, HEIGHT)) for y in range(0, HEIGHT, TILESIZE): pg.draw.line(self.screen, LIGHTGREY, (0, y), (WIDTH, y)) - # def draw(self, drawable_object, pos): # # pos => (x, y) # # drawable object must have .image field inside class @@ -81,7 +84,7 @@ class Game(): def draw(self): pg.display.set_caption("{:.2f}".format(self.clock.get_fps())) self.screen.blit(self.map_img, self.camera.apply_rect(self.map_rect)) - + for sprite in self.all_sprites: self.screen.blit(sprite.image, self.camera.apply(sprite)) if self.draw_debug: @@ -89,7 +92,7 @@ class Game(): if self.draw_debug: for wall in self.walls: pg.draw.rect(self.screen, CYAN, self.camera.apply_rect(wall.rect), 1) - + pg.display.flip() def events(self): @@ -111,11 +114,12 @@ class Game(): # def reloadMap(self): # #self.screen.fill(pygame.Color(self.BACKGROUND_COLOR)) # self.screen.blit(self.map_img, (0,0)) - + + # def main(): # game = WalleGame() # game.update_window() - + # smieciara_object = trashmaster(16,16,"./resources/textures/garbagetruck/trashmaster_blu.png") # game.draw_object(smieciara_object, (100, 100)) @@ -126,7 +130,7 @@ class Game(): # game.update_window() # running = True - + # while running: # for event in pygame.event.get(): # if event.type == pygame.QUIT: @@ -134,14 +138,38 @@ class Game(): # if event.type == pygame.KEYDOWN: # game.reloadMap() # game.draw_object(smieciara_object, smieciara_object.movement(event.key, 16)) - + # game.update_window() # pygame.quit() # if __name__ == '__main__': # main() +def graph(): + with open('data.txt', 'r') as f: + matrix = [[int(x) for x in line.split(',') if x != '\n'] for line in f.readlines()] + adj = {} + for yi, yvalue in enumerate(matrix): + for xi, xvalue in enumerate(matrix): + if xi - 1 >= 0 and matrix[yi][xi - 1] == 0: + adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi - 1, yi)] + + if xi + 1 < len(matrix[yi]) and matrix[yi][xi + 1] == 0: + adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi + 1, yi)] + + if yi - 1 >= 0 and matrix[yi - 1][xi] == 0: + adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi, yi - 1)] + + if yi + 1 < len(matrix) and matrix[yi + 1][xi] == 0: + adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi, yi + 1)] + + l = sorted(list(adj.items()), key=lambda x: (x[0])) + print(*l, sep='\n') + + return l +start_node = (0, 2) +target_node = (0, 2) # create the game object g = Game() g.show_start_screen() @@ -149,4 +177,4 @@ while True: g.new() g.run() g.show_go_screen() - + SearchBfs.BreadthSearchAlgorithm(graph, start_node, target_node) -- 2.20.1 From 50258414f75c4d4edbc311d34efa75d2ff3687ef Mon Sep 17 00:00:00 2001 From: trzmielewskiR Date: Thu, 7 Apr 2022 23:04:25 +0200 Subject: [PATCH 4/5] bfs third try, repaired, need to print the path from start to goal --- SearchBfs.py | 53 +++++++++++++++++++++++++++++++++++----------------- main.py | 28 +++------------------------ 2 files changed, 39 insertions(+), 42 deletions(-) diff --git a/SearchBfs.py b/SearchBfs.py index f862837..1269fdf 100644 --- a/SearchBfs.py +++ b/SearchBfs.py @@ -1,27 +1,46 @@ class BreadthSearchAlgorithm: - def __init__(self, graph, start, target): - self.graph = graph + def __init__(self, start, target): + self.graph = self.getData() self.start = start self.target = target def bfs(self): - queue = [[self.start]] + print("It's showtime") + can_go = [self.start] visited = [] - if self.start == self.target: - return - - while queue: - path = queue.pop(0) - node = path[-1] + print("Start = Target") + return -1 + while can_go != []: + node = can_go.pop(0) if node not in visited: - neighbours = self.graph - for neighbour in neighbours: - next_path = list(path) - next_path.append(neighbour) - queue.append(next_path) - if neighbour == self.target: - return next_path visited.append(node) + if node == self.target: + return visited + neighbours = self.graph.get(node, []) + for neighbour in neighbours: + can_go.append(neighbour) + print(visited) + return -1 - return "Path found" + def getData(self): + with open("data.txt", "r") as f: + matrix = [ + [int(x) for x in line.split(",") if x != "\n"] for line in f.readlines() + ] + adj = {} + for yi, yvalue in enumerate(matrix): + for xi, xvalue in enumerate(matrix): + if xi - 1 >= 0 and matrix[yi][xi - 1] == 0: + adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi - 1, yi)] + + if xi + 1 < len(matrix[yi]) and matrix[yi][xi + 1] == 0: + adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi + 1, yi)] + + if yi - 1 >= 0 and matrix[yi - 1][xi] == 0: + adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi, yi - 1)] + + if yi + 1 < len(matrix) and matrix[yi + 1][xi] == 0: + adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi, yi + 1)] + + return adj \ No newline at end of file diff --git a/main.py b/main.py index 23a34da..a3b7169 100644 --- a/main.py +++ b/main.py @@ -144,37 +144,15 @@ class Game(): # pygame.quit() # if __name__ == '__main__': # main() -def graph(): - with open('data.txt', 'r') as f: - matrix = [[int(x) for x in line.split(',') if x != '\n'] for line in f.readlines()] - adj = {} - for yi, yvalue in enumerate(matrix): - for xi, xvalue in enumerate(matrix): - if xi - 1 >= 0 and matrix[yi][xi - 1] == 0: - adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi - 1, yi)] - - if xi + 1 < len(matrix[yi]) and matrix[yi][xi + 1] == 0: - adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi + 1, yi)] - - if yi - 1 >= 0 and matrix[yi - 1][xi] == 0: - adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi, yi - 1)] - - if yi + 1 < len(matrix) and matrix[yi + 1][xi] == 0: - adj[(xi, yi)] = adj.get((xi, yi), []) + [(xi, yi + 1)] - - l = sorted(list(adj.items()), key=lambda x: (x[0])) - print(*l, sep='\n') - - return l - start_node = (0, 2) -target_node = (0, 2) +target_node = (5, 3) +find_path = BreadthSearchAlgorithm(start_node, target_node) # create the game object g = Game() g.show_start_screen() while True: g.new() + path_found = find_path.bfs() g.run() g.show_go_screen() - SearchBfs.BreadthSearchAlgorithm(graph, start_node, target_node) -- 2.20.1 From d85762207169deabbd475babb0983aa029c1dd48 Mon Sep 17 00:00:00 2001 From: Bartosz Wieczorek Date: Fri, 8 Apr 2022 10:51:10 +0200 Subject: [PATCH 5/5] [bfsAlgorithm] added master node history --- SearchBfs.py | 18 +++++++++++------- data.txt | 36 ++++++------------------------------ main.py | 4 ++-- 3 files changed, 19 insertions(+), 39 deletions(-) diff --git a/SearchBfs.py b/SearchBfs.py index 1269fdf..aa93eae 100644 --- a/SearchBfs.py +++ b/SearchBfs.py @@ -6,21 +6,25 @@ class BreadthSearchAlgorithm: def bfs(self): print("It's showtime") - can_go = [self.start] + can_go = [[self.start, 0]] visited = [] + visitedPrint = [] if self.start == self.target: print("Start = Target") return -1 while can_go != []: node = can_go.pop(0) - if node not in visited: - visited.append(node) - if node == self.target: + if node[0] not in visited: + visited.append(node[0]) + visitedPrint.append(node) + if node[0] == self.target: + print('final') + print(visitedPrint) return visited - neighbours = self.graph.get(node, []) + neighbours = self.graph.get(node[0], []) for neighbour in neighbours: - can_go.append(neighbour) - print(visited) + can_go.append([neighbour, node[0]]) + # print(visited) return -1 def getData(self): diff --git a/data.txt b/data.txt index 13f9675..1b0cfbe 100644 --- a/data.txt +++ b/data.txt @@ -1,30 +1,6 @@ -11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, -11,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,11, -11,0,0,0,0,0,0,0,0,0,35,0,0,0,0,0,0,0,0,0,2684354599,35,17,25,0,24,29,33,7,11, -11,7,0,0,23,0,17,14,12,0,13,0,16,13,0,24,0,42,13,25,0,45,22,29,0,44,0,0,7,11, -11,7,0,0,15,0,45,37,17,0,0,0,24,12,0,45,0,44,24,14,0,0,0,0,0,37,0,23,7,11, -11,7,0,0,13,0,0,0,41,25,0,20,16,41,22,35,0,29,37,21,0,17,42,0,0,25,0,0,7,11, -11,7,0,26,27,28,29,0,21,43,0,29,0,0,0,0,0,0,0,0,0,0,43,0,536870952,0,2684354599,0,7,11, -11,7,0,14,0,24,21,0,15,33,0,21,0,43,21,33,0,45,30,31,16,0,12,0,0,0,0,0,7,11, -11,7,0,42,0,22,20,0,0,0,0,44,0,20,40,16,0,43,0,33,13,0,45,0,17,0,43,0,7,11, -11,7,0,25,0,13,0,0,15,24,0,0,0,41,0,29,0,15,0,0,44,0,37,0,21,0,24,0,7,11, -11,7,0,0,0,0,0,33,29,0,17,12,0,21,0,0,0,17,43,0,13,29,41,0,24,0,13,0,7,11, -11,7,0,15,18,45,0,13,41,0,24,16,0,23,0,13,41,22,16,0,20,32,17,0,29,25,35,0,7,11, -11,7,0,25,35,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,0,0,0,0,0,0,0,7,11, -11,7,0,0,34,19,0,44,15,0,2684354596,2684354596,0,18,24,0,17,35,0,41,25,0,41,0,13,0,44,0,7,11, -11,7,24,0,0,0,0,0,0,0,0,0,0,42,20,0,16,0,0,0,24,0,21,0,18,0,25,0,7,9, -11,7,22,0,33,13,16,43,21,20,29,15,0,41,24,0,29,13,0,16,43,0,18,24,42,0,42,23,7,9, -11,7,21,0,21,20,0,0,0,0,41,44,0,42,15,0,0,0,0,0,0,0,0,0,0,0,0,0,7,9, -11,7,24,0,41,24,0,3221225510,1610612774,0,24,21,0,13,40,20,0,17,32,15,44,0,26,27,28,0,18,25,7,11, -11,7,18,0,44,12,0,2684354598,38,0,17,22,0,41,0,0,0,0,0,24,20,0,21,35,33,0,12,24,7,11, -11,7,13,0,0,0,0,0,0,0,0,0,0,12,15,21,0,13,35,18,41,37,43,39,15,0,22,18,7,11, -11,7,15,0,43,15,0,33,17,41,0,29,18,33,0,0,0,0,0,0,0,0,0,0,0,0,0,24,7,11, -11,7,13,0,25,0,0,0,0,39,21,42,44,14,0,18,45,0,13,14,0,29,0,42,13,0,25,35,7,11, -11,7,24,0,14,18,23,24,0,13,0,0,0,0,0,21,42,0,41,15,2684354599,21,0,15,0,0,0,24,7,11, -11,7,18,0,0,0,0,0,0,3221225508,0,21,15,0,41,29,0,0,0,0,43,14,18,42,0,14,0,18,7,11, -11,7,14,40,43,0,43,14,0,0,0,29,17,18,22,24,0,17,23,0,13,30,31,25,0,33,0,32,7,11, -11,7,14,0,44,0,12,0,0,24,14,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,15,7,11, -11,7,25,0,29,0,14,13,25,14,43,0,15,13,0,44,33,0,25,0,13,44,0,43,15,44,0,42,7,11, -11,7,23,0,0,0,0,0,0,0,0,0,32,45,0,35,25,0,0,0,0,0,0,32,0,0,0,18,7,11, -11,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,11, -11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11 \ No newline at end of file +0,0,0,0,0,0 +0,1,1,0,0,0 +0,1,0,0,0,0 +0,1,0,0,0,0 +0,1,0,0,0,0 +0,1,0,0,0,0 \ No newline at end of file diff --git a/main.py b/main.py index a3b7169..0fe1706 100644 --- a/main.py +++ b/main.py @@ -145,8 +145,8 @@ class Game(): # if __name__ == '__main__': # main() -start_node = (0, 2) -target_node = (5, 3) +start_node = (0, 0) +target_node = (2, 2) find_path = BreadthSearchAlgorithm(start_node, target_node) # create the game object g = Game() -- 2.20.1