-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (25 loc) · 875 Bytes
/
main.py
File metadata and controls
33 lines (25 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from grid import Grid
from pathfinding import astar, bfs
from renderer import Renderer
from dungeon import generate_dungeon
def main():
print("Script started successfully.")
walls = {(0,3), (1, 1), (1, 2), (7, 0), (7, 1), (7, 2), (7, 3), (7, 4), (7, 5), (7, 6), (7, 7), (7, 8)}
grid = Grid(10, 10, walls)
start = (0, 0)
goal = (9, 9)
path = bfs(start, goal, grid)
print(path)
print("BFS path length:", len(path) if path else "No path found.\n")
renderer = Renderer(grid)
renderer.render(path)
path = astar(start, goal, grid)
print(path)
print("BFS path length:", len(path) if path else "No path found.\n")
renderer.render(path)
dungeon = generate_dungeon(40, 40, 6)
renderer = Renderer(grid=dungeon)
renderer.render()
print("Script finished successfully.")
if __name__ == "__main__":
main()