1
0
Fork 0

Fixed bug that last level wouldn't be drawn

This commit is contained in:
Jan Christian Grünhage 2015-02-12 07:50:20 +01:00
parent 5e998cc9b1
commit d33b2a3b23
1 changed files with 3 additions and 2 deletions

View File

@ -28,16 +28,17 @@ public class PythagorasTree {
}
public static boolean drawNextTree(PythagorasTreeQueue queue) {
if (queue.size() == 0) return false;
PythagorasTree tree = queue.remove();
if (tree.momentaryDepth>= tree.maximalDepth) return true;
tree.turtle.getFrame().setTitle("Pythagoras Tree - Depth: " + tree.momentaryDepth + " - Target Depth: " + tree.maximalDepth + " - Queuesize: " + queue.size());
tree.turtle.setPenColor(drawColor(tree.momentaryDepth, tree.maximalDepth));
tree.turtleState.returnToState(tree.turtle);
DrawingTools.drawSquare(tree.turtle, tree.size);
if (tree.momentaryDepth + 1 >= tree.maximalDepth) return false;
tree.turtle.forward(tree.size);
tree.turtle.pushState();