Simplify HilbertServer

This commit is contained in:
Manuel Thalmann 2022-10-18 13:17:11 +02:00
parent 7d56d30e19
commit d76b797dce

View file

@ -15,7 +15,7 @@ public class HilbertServer implements CommandExecutor {
}
private void hilbert(Turtle turtle, int depth, double dist, double angle) {
if (depth > 0) {
if (depth >= 0) {
turtle.turn(-angle);
hilbert(turtle, depth - 1, dist, -angle);
@ -31,14 +31,6 @@ public class HilbertServer implements CommandExecutor {
hilbert(turtle, depth - 1, dist, -angle);
turtle.turn(-angle);
} else {
turtle.turn(-angle);
turtle.move(dist);
turtle.turn(angle);
turtle.move(dist);
turtle.turn(angle);
turtle.move(dist);
turtle.turn(-angle);
}
}
}