Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Maze/maze_solver.cpp
- Revision:
- 30:daf286ac049f
- Parent:
- 28:600932142201
- Child:
- 31:f7a8a9b82bc1
diff -r 2224bc8bb49d -r daf286ac049f Maze/maze_solver.cpp --- a/Maze/maze_solver.cpp Sat May 27 08:07:13 2017 +0000 +++ b/Maze/maze_solver.cpp Sun May 28 06:49:41 2017 +0000 @@ -39,7 +39,7 @@ } bool Maze:: is_center(unsigned char x, unsigned char y) { - unsigned char goal1 = MAZE_SIZE / 2; + unsigned char goal1 = MAZE_SIZE / 2; unsigned char goal2 = (MAZE_SIZE - 1) / 2; if (manhattan_dist(y, goal1, x, goal1) == 0 || manhattan_dist(y, goal1, x, goal2) == 0 || @@ -305,6 +305,10 @@ } } +void Mouse::clear_stack() { + stk.clear(); +} + void Mouse:: move_one_cell() { check_open_neighbor(); update_distance(); @@ -383,6 +387,9 @@ if (prev_mouse_dir == direction) { + if (prev_mouse_dir == NORTH && direction == NORTH) { + can_reset_mouse = true; + } state = STRAIGHT; } // Mouse is facing south @@ -437,6 +444,7 @@ Mouse:: Mouse(DriveControl * prev_driver) { + can_reset_mouse = false; driver = prev_driver; detected_maze = new Maze(); prev = (unsigned char) 5;