User Tools

Site Tools


stairsweeper

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
Last revisionBoth sides next revision
stairsweeper [2019/08/23 09:43] – [StairSweeper.java] frchrisstairsweeper [2019/08/23 09:47] frchris
Line 16: Line 16:
  public void climbStair()   public void climbStair() 
         {         {
- turnLeft(); + // code needed here
- move(); +
- turnRight(); +
- move();+
  }  }
  
  private void turnRight()   private void turnRight() 
         {         {
- turnLeft(); + //coded needed here
- turnLeft(); +
- this.turnLeft();+
  }  }
  
Line 37: Line 32:
 import kareltherobot.World; import kareltherobot.World;
  
-public class StairSweeperRunner implements Directions{+public class StairSweeperRunner implements Directions 
 +{
  
- public static void main(String[] args) {+ public static void main(String[] args)  
 +        {
  String steps = "streets 10\n" +   String steps = "streets 10\n" + 
  "avenues 10\n" +   "avenues 10\n" + 
Line 56: Line 53:
  World.getWorld(steps);  World.getWorld(steps);
  World.setVisible();  World.setVisible();
-        task();+                task();
  }  }
  
- private static void task() {+ private static void task()  
 +        {
  StairSweeper alexa = new StairSweeper(1,1, East, 0);  StairSweeper alexa = new StairSweeper(1,1, East, 0);
  alexa.climbStair();  alexa.climbStair();
  alexa.pickBeeper();  alexa.pickBeeper();
- alexa.climbStair(); + alexa.turnOff();
- alexa.pickBeeper(); +
- alexa.climbStair(); +
- alexa.pickBeeper(); +
- alexa.turnLeft();+
   
  }  }
stairsweeper.txt · Last modified: 2023/08/22 09:50 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki