Improve readability of HilbertServer
This commit is contained in:
parent
aecc499585
commit
7d56d30e19
1 changed files with 4 additions and 0 deletions
|
@ -17,14 +17,18 @@ 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);
|
||||||
turtle.move(dist);
|
turtle.move(dist);
|
||||||
turtle.turn(angle);
|
turtle.turn(angle);
|
||||||
|
|
||||||
hilbert(turtle, depth - 1, dist, angle);
|
hilbert(turtle, depth - 1, dist, angle);
|
||||||
turtle.move(dist);
|
turtle.move(dist);
|
||||||
|
|
||||||
hilbert(turtle, depth - 1, dist, angle);
|
hilbert(turtle, depth - 1, dist, angle);
|
||||||
turtle.turn(angle);
|
turtle.turn(angle);
|
||||||
turtle.move(dist);
|
turtle.move(dist);
|
||||||
|
|
||||||
hilbert(turtle, depth - 1, dist, -angle);
|
hilbert(turtle, depth - 1, dist, -angle);
|
||||||
turtle.turn(-angle);
|
turtle.turn(-angle);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue