Simplify HilbertServer
This commit is contained in:
parent
7d56d30e19
commit
d76b797dce
1 changed files with 1 additions and 9 deletions
|
@ -15,7 +15,7 @@ public class HilbertServer implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hilbert(Turtle turtle, int depth, double dist, double angle) {
|
private void hilbert(Turtle turtle, int depth, double dist, double angle) {
|
||||||
if (depth > 0) {
|
if (depth >= 0) {
|
||||||
turtle.turn(-angle);
|
turtle.turn(-angle);
|
||||||
|
|
||||||
hilbert(turtle, depth - 1, dist, -angle);
|
hilbert(turtle, depth - 1, dist, -angle);
|
||||||
|
@ -31,14 +31,6 @@ public class HilbertServer implements CommandExecutor {
|
||||||
|
|
||||||
hilbert(turtle, depth - 1, dist, -angle);
|
hilbert(turtle, depth - 1, dist, -angle);
|
||||||
turtle.turn(-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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue