The aim of this puzzle: Create the Gabonese flag with one line of code.
Walkthrough of the solution: This puzzle is very similar to the Gabonese Flag Helper. There is just one extra shortcut –
newLine() can be replaced with a space in the string given to
Inside of the parentheses of
drawBoxes() you need to edit the string.
drawBoxes() will look at each character in its string: if it’s a letter, draw a box with the color that letter stands for; if it’s a space, go to a new line. So,
drawBoxes('g g') is the same as
drawBox(green); newLine(); drawBox(green);
To draw the Gabonese flag, you need three rows: green, green, green, new line, yellow, yellow, yellow, new line, then blue, blue, blue. That means the string that goes inside of
'ggg yyy bbb'.
Sample code solution:
(Tap below to reveal)
drawBoxes('ggg yyy bbb');
Grasshopper Concepts: drawBoxes()