Quick French Flag explainer

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:


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)


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

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.

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”.


Hi I’m try solution but I am not solution please help me

Hey there, I moved your post into this thread. Take a look at the other posts and see if they help.

With the drawBox() function, you can write the whole name of the color, like 'red' or 'white'.

With drawBoxes(), which is what you are using in this puzzle, each letter in a string represents a color.

For example:


is the same as:


Hope that helps! Let me know if you have any questions.