The aim of this puzzle: Create the Estonian flag with one line of code.
Walkthrough of the solution: When there is a space in the string given to drawBoxes()
, it will create a newLine()
.
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 Estonian flag, you need 9 boxes: blue, blue blue, new line, ebony, ebony, ebony, new line, then white, white, white. That means the string that goes inside of drawBoxes()
is 'bbb eee www'
.
Sample code solution:
(Tap below to reveal)
drawBoxes('bbb eee www');
JavaScript Concepts: Calling Functions, Identifiers
Grasshopper Concepts: drawBoxes()