User Tools

Site Tools


mazewalker

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mazewalker [2019/08/29 23:41]
frchris
mazewalker [2019/08/29 23:59] (current)
frchris
Line 3: Line 3:
 ====== Before ====== ====== Before ======
  
-{{::​turnrightbefore.png?400|}}+{{::​turnrightbefore.png|}}
 ====== After ====== ====== After ======
-{{::​turnrightafter.png?400|}}+{{::​turnrightafter.png|}}
  
-Here are four of the different position changes ​that the robot must be able to make.  This instruction ​is the cornerstone for the program ​that directs a robot to escape from a maze.  It isn't the most efficient algorithm, and it won't work on mazes that have islands (Can you imagine why?​). ​ Do you think following the left walls would be better? ​+These four different position changes is the cornerstone for the algorithm ​that directs a robot to escape from a maze simply by following the right wall.  It isn't the most efficient algorithm, and it won't work on mazes that have islands (Can you imagine why?​). ​ Do you think following the left walls would be better? ​
  
- 
-  
-{{ ::​mazewalkertester.java |MazeWalkerTester.java}} 
- 
-Once the tester shows that the four cases are handled correctly, here is a maze runner class with its own maze: 
- 
-{{ ::​mazewalkerrunner.java |MazeWalkerRunner.java}} 
  
 <code java> <code java>
Line 22: Line 15:
 { {
  
- public MazeWalker(int street, int avenue, Direction direction, int beepers) {+ public MazeWalker(int street, int avenue, ​ 
 +                       Direction direction, int beepers) ​ 
 +       {
  super(street,​ avenue, direction, beepers);  super(street,​ avenue, direction, beepers);
   
Line 37: Line 32:
     /**     /**
      * This will move the Robot according to the diagram      * This will move the Robot according to the diagram
-     ​* ​mentioned.+     ​* ​above Use if () else statements to handle the 4 cases
      */      */
  public void followRightWall() ​  public void followRightWall() ​
Line 51: Line 46:
 } }
 </​code>​ </​code>​
 +
 +
 +First use the ''​MazeWalkerTester''​ to see if your code deals with the four situations correctly.
 + 
 +{{ ::​mazewalkertester.java |MazeWalkerTester.java}}
 +
 +Once the tester shows that the four cases are handled correctly, here is a maze runner class with its own maze:
 +
 +{{ ::​mazewalkerrunner.java |MazeWalkerRunner.java}}
 +
 +Hints:
 +  * Case One check: is the front clear?
 +  * Case 2,3,4 you can move
 +  * Case 2 versus case 3,4: is there a wall on the right?
 +  * In case 3 and 4 you can move to the right.
 +  * Case 3 versus case 4: is there a wall on the right?
mazewalker.1567136493.txt.gz · Last modified: 2019/08/29 23:41 by frchris