-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
56 lines (50 loc) · 1.4 KB
/
test.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import maze
import os
def play():
""" Simple function to play the generated maze.
"""
m = maze.Maze(20,20)
m.recdiv_generation_start()
os.system("clear")
while(not m.has_ended()):
print(m)
key = False
while(not key):
key = True
uinput= input("\nEntrada:\nw := arriba\na := izquierda\ns := abajo\nd := derecha\n")
if uinput[-1] == "w" or uinput[-1] == "W":
m.move_up()
elif uinput[-1] == "a" or uinput[-1] == "A":
m.move_left()
elif uinput[-1] == "s" or uinput[-1] == "S":
m.move_down()
elif uinput[-1] == "d" or uinput[-1] == "D":
m.move_right()
else:
print("INVALID INPUT")
key = False
# sys.stdout.flush()
os.system("clear")
print(m)
print("\n YOU WIN!!! ")
def dfs_test():
""" Executes the Deep First Search algorithm over a random maze.
"""
import ai.dfs as ai
bfs = ai.DFS()
bfs.start()
def bfs_test():
""" Executes the Best First Search algorithm over a random maze.
"""
import ai.bfs as ai
bfs = ai.BFS()
bfs.start()
def main():
""" Main function, call here the functions to run the different algorithms
or play a random maze.
"""
# play()
# dfs_test()
bfs_test()
if __name__ == "__main__":
main()