From d76b797dce4bf5027abbd5f500096d6d0b746690 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 18 Oct 2022 13:17:11 +0200 Subject: [PATCH] Simplify HilbertServer --- .../main/java/ch/nuth/zhaw/exbox/HilbertServer.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/app/src/main/java/ch/nuth/zhaw/exbox/HilbertServer.java b/app/src/main/java/ch/nuth/zhaw/exbox/HilbertServer.java index eb2fb98..0fc4a2a 100644 --- a/app/src/main/java/ch/nuth/zhaw/exbox/HilbertServer.java +++ b/app/src/main/java/ch/nuth/zhaw/exbox/HilbertServer.java @@ -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); } } }