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 revisionPrevious revision
Next revision
Previous revision
mazewalker [2019/08/29 23:52] frchrismazewalker [2022/09/05 12:25] (current) – [MaveWalker Troubleshooting] frchris
Line 32: 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 46: Line 46:
 } }
 </code> </code>
 +
  
 First use the ''MazeWalkerTester'' to see if your code deals with the four situations correctly. First use the ''MazeWalkerTester'' to see if your code deals with the four situations correctly.
Line 54: Line 55:
  
 {{ ::mazewalkerrunner.java |MazeWalkerRunner.java}} {{ ::mazewalkerrunner.java |MazeWalkerRunner.java}}
 +
 +
 +===== Running your MazeWaker with Student Mazes =====
 +
 +Download the text file you find at [[https://www.mathorama.com/karel/maze/]] and put it in the same folder as the project that has your MazeWalker.java.  Change the name of the file in the Runner file:
 +<code MazeWalkerRunner.java>
 +import java.awt.Color;
 +import kareltherobot.*;
 +public class MazeWalkerRunner implements Directions
 +{
 +    public static void task()
 +    {
 +        // change the location to where the first beeper is:
 +        MazeWalker mayzie = new MazeWalker(1,1,North,0);  
 +        mayzie.pickBeeper(); // pick up the first beeper
 +        mayzie.escapeMaze();
 +        mayzie.turnOff();
 +    }
 +
 +    public static void main(String[] args)
 +    {
 +        World.reset();
 +        World.setDelay(1);
 +        World.setBeeperColor(Color.RED);
 +        // change the name to match the maze world file
 +        World.readWorld("BobS.txt"); 
 +        World.setVisible();
 +        task();
 +    }
 +}
 +</code>
 +
 +===== MazeWalker Troubleshooting =====
 +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?
 +====== Links ======
 +  * [[https://mathorama.com/wiki/doku.php?id=karl_j_robot|Karel Intro]]
 +  * [[https://mathorama.com/karel/|Karel Files @ mathorama.com/karel/]]
 +  * [[https://mathorama.com/wiki/doku.php?id=make_a_maze|Make a Maze]]
 +  * [[https://mathorama.com/wiki/doku.php?id=try_running_these_student_made_mazes|Student Made Mazes]]
  
mazewalker.1567137121.txt.gz · Last modified: 2019/08/29 23:52 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki