package Kaja.sandbox.sandbox;
/*Generated by MPS */
import JavaKaja.runtime.KajaFrame;
public class Karel extends KajaFrame {
public Karel() {
}
protected void perform() {
turnRight_routine();
while (!(isMark())) {
traceStep_routine();
}
// Routine definitions
}
public void traceStep_routine() {
if (!(isFull())) {
addMark();
pause();
} else {
reportError("Cannot drop. The cell is already full.");
}
safeStep_routine();
}
public void safeStep_routine() {
while (isWall()) {
try {
turnLeft();
pause();
} finally {
}
}
if (canMove()) {
moveKaja();
pause();
} else {
reportError("Oops, There's a wall in front of me. I can't make a step forward.");
}
}
public void turnRight_routine() {
for (int indexVariable_ligmp_a0c = 0; indexVariable_ligmp_a0c < 3; indexVariable_ligmp_a0c++) {
try {
turnLeft();
pause();
} finally {
}
}
}
public void turnAround_routine() {
try {
turnLeft();
pause();
} finally {
}
try {
turnLeft();
pause();
} finally {
}
}
public static void main(String[] args) {
Karel script = new Karel();
script.initializeComponents();
script.run();
}
}