Quick French Flag explainer


#1

The aim of this puzzle: Draw the French flag using two drawBoxes() functions and a newLine() function.

Walkthrough of the solution: In the code view, the puzzle starts with:

drawBoxes('bwr')

Which draws a blue box (‘b’), a white box (‘w’) and then a red box (‘r’). The aim of the puzzle is to create the French Flag. To do that, the Grasshopper cursor needs to be moved onto the next line, then the pattern repeated (blue box, then white box, then red box). To move the cursor onto a new line the newLine() function should be used. Once the cursor is on a new line, add another drawBoxes() function and then tap on the str key to bring up a qwerty keyboard and enter the string 'bwr'.

Sample code solution:
(Tap below to reveal)

drawBoxes('bwr');
newLine();
drawBoxes('bwr');

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


#2

Why is the b in the string ‘bwr’ stand for blue and not another colour starting with the letter b? Same question applies for the other colours.
Thanks.


#3

Here’s a different post with a list of all the color names. There is other code built into the app that converts each string into an RGB value. Creating custom colors using RGB values is introduced in a later puzzle, “Custom Colors”.

–Frankie