Welche Zeilen sollen verglichen werden und wohin soll welcher Pilz verschoben werden?
In deinem Beispiel gibt’s zB keine gleichen Zeilen, dort soll also einfach nichts passieren?
Alle Zeilen von 0 - 10.der pitz soll um einen kasten verschroben werden
wenn die Zeilen nicht gleiche anzahl von Blaettern hat, dann soll nichts passieren
Ich habe jetzt den code geschrieben und bleibe stecken mit dem vergleichen.
[CODE lang="java" title="comparison"]boolean[][] leafComparison = new boolean[10][10];
System.out.println ("-------------------------");
int y = 0;
int x = 1;
checkLeavesLocation(leafComparison, x ,y);
}
void checkLeavesLocation(boolean[][] leafComparison, int x, int y) {
for (; y < 10; y++) {
for (; x < 10; x++) {
if (isOnLeaf()) {
leafComparison[y][x] = true;
System.out.println(String.valueOf(leafComparison[y][x]));
}
else {
leafComparison[y][x] = false;
System.out.println(String.valueOf(leafComparison[y][x]));
}
move();
}
System.out.println ("-------------------------");
turnAround();
walkBack();
nextLine();
}
}
void turnAround() {
turnRight();
turnRight();
}
void nextLine() {
turnLeft();
move();
turnLeft();
}
void walkBack() {
for (int steps = 1; steps < 10; steps++) {
move();
}
}
}[/CODE]