forked from mackorone/mms-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.py
38 lines (28 loc) · 972 Bytes
/
Main.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
import API
from Direction import Direction
from Maze import Maze
from Mouse import Mouse
def main():
dimensions = (API.mazeWidth(), API.mazeHeight())
# import random as r
# goal = (r.randint(0, dimensions[0] - 1),
# r.randint(0, dimensions[1] - 1))
# dimensions = (5, 5)
start = (0, 0)
goal = (dimensions[0] // 2, dimensions[1] // 2)
API.log("Goal: {}".format(goal))
API.setColor(*goal, "g")
maze = Maze(*dimensions)
mouse = Mouse(start, direction=Direction.NORTH, maze=maze)
API.log("Starting mouse exploration")
mouse.find_goal_explore(goal)
API.log("Starting mouse return to start")
mouse.return_to_start(start, goal)
API.log("Starting mouse follow path")
fastest_path = maze.find_fastest_path(start, goal)
mouse.follow_path(fastest_path)
API.log("Starting mouse fast goal search")
mouse.find_goal_fast(goal)
API.log("Mouse found goal")
if __name__ == "__main__":
main()