The aim of this puzzle: Draw the French flag.
Walkthrough of the solution: Each
drawBox() will draw one box. The color inside
drawBox() determines the color of the box it draws, so
drawBox(white) will draw one white box.
newLine() moves the output onto a new line so that boxes drawn after
newLine() will be below boxes drawn before
newLine(). The French flag in this puzzle needs to be three boxes wide and two boxes tall. This means there needs to be 6
drawBox()’s since there need to be 6 boxes, and 1
newLine() for the boxes to be on top of each other. The pattern for the French flag is a blue stripe, then a white stripe, then a red stripe.
Sample code solution:
(Tap below to reveal)
drawBox(blue); drawBox(white); drawBox(red); newLine(); drawBox(blue); drawBox(white); drawBox(red);
Grasshopper Concepts: drawBox(), newLine()