Hello,
Is there a way to write the methods without having to repeat the entire original command? For example, can you say something like "repeat the above command 2 more times" but in Java? I have to write
lisa.move(); multiple times; this is more specific than looping the main subclass.
PHP Code:
import com.jojoba.karel2.Display;
import com.jojoba.karel2.Robot;
public class Lab01
{
public static void main(String[] args)
{
Display.openWorld("maps/school.map");
Display.setSize(10, 10);
Display.setSpeed(5);
Robot lisa = new Robot();
Robot pete = new Robot(4, 5, Display.SOUTH, 0);
lisa.move();
lisa.move();
lisa.turnLeft();
lisa.move();
lisa.turnLeft();
lisa.move();
lisa.pickBeeper();
lisa.turnLeft();
lisa.turnLeft();
lisa.move();
lisa.turnLeft();
lisa.turnLeft();
lisa.turnLeft();
lisa.move();
lisa.turnLeft();
lisa.move();
lisa.move();
lisa.move();
}
}
*Note that the robot named Pete is not on the list, that is not part of my problem. Additionally, I'm working on developing a
turnRight(); action, probably using an inherited event.