Here we will begin the construction of a special class that you can use as a base class that you inherit in your robot classes. It will contain a number of commonly used robot actions and will ease the development of later projects. The class will be called SuperRobot and it will have UrRobot as a superclass initially, though this will change later, when you know more. This process of changing existing code is called "refactoring".
It might be the base class of a StairClimber, for example:
public class StairClimber extends SuperRobot { ...
The SuperRobot class goes in its own Java class file, saved in a place where you can easily find it, such as the karel package:
package karel;
import kareltherobot.*;
public class SuperRobot extends Robot {
public SuperRobot(int street, int avenue, Direction direction, int beepers) {
super(street, avenue, direction, beepers);
}
public void turnRight() {
turnLeft();
turnLeft();
turnLeft();
}
public void turnAround() {
turnLeft();
turnLeft();
}
}
Other useful actions are
backUp - keeping the original direction at the end, but moving back one corner.
slideLeft - moving one corner to the left, keeping the original direction.
slideRight - moving one corner to the right.
Note in your documentation that some of these can fail. For example, a robot at the origin may not be able to backUp.