DoubleBeepersKarel
Retired DISLab
import stanford.karel.SuperKarel; public class DoubleBeepersKarel extends SuperKarel { public void run() { move(); doubleBeepers(); //move(); transferBeepersBack(); paintCorner(YELLOW); } public void doubleBeepers() { if (beepersPresent()) { pickBeeper(); doubleBeepers(); putBeeper(); putBeeper(); } } private void transferBeepersBack() { while (beepersPresent()) { pickBeeper(); move(); putBeeper(); turnAround(); move(); turnAround(); } } public static void main(String[] args) { /* String[] newArgs = new String[args.length + 1]; System.arraycopy(args, 0, newArgs, 0, args.length); newArgs[args.length] = "code=" + new SecurityManager(){ public String className() { return this.getClassContext()[1].getCanonicalName(); } }.className(); SuperKarel.main(newArgs); */ new DoubleBeepersKarel().start(args); } }