Gabonese Flag Shortcuts explainer


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 drawBoxes().

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 drawBoxes() is 'ggg yyy bbb'.
Sample code solution:
(Tap below to reveal)

drawBoxes('ggg yyy bbb');

JavaScript Concepts: Calling Functions, Identifiers
Grasshopper Concepts: drawBoxes()


Initially missed your y and added 3 more in my solution before my BBB. It told me that I made an error and I went back to correct it. My corrected solution ran correctly but it has me locked in and keeps telling me to hit reset. Don’t see a"reset". How do I proceed? Thanks


Found reset button, did my corrected solution again and it ran correctly but still will not complete the lesson. Tells me, again, that a new line of code was added and to hit reset again.


In this puzzle, the entire flag can be created using 1 line of code. It’s possible to make a flag using more lines of code, but this puzzle will only pass if you can do it in 1 line.

There are 11 commands that need to run in total: 3 greens, a new line, 3 yellows, a new line, 3 blues. This is represented as a string, 'ggg yyy bbb'. You could break up this string and put each part into a separate drawBoxes() call, but there’s no need.