The aim of this puzzle: To recreate the automated box pattern with drawBoxes.
Walkthrough of the solution: You want to try to read the boxes row by row in the order the grasshopper jumps. It jumps on the green box, then the orange box in the first row. Since the
drawBoxes() function will draw a green box if we give it a
'g' and an orange box from an
'o', you can use
drawBoxes('go') to create the first row of the pattern. The grasshopper jumps from the orange box to the second row which means you need a
drawBox() will do that for you if you give it a space: ’ '. The full command for the first row is
drawBoxes('go '); Next, take a look at the second row of colors – they are blue, orange, blue. Taking the first letter of each color, you get
'b'. Now you know how to draw the second row of the pattern:
drawBoxes('bob'); You can combine the strings for the first and second rows to get
drawBoxes('go bob'); You can use another space at the end to start the third row. Finally, the colors in the last row are the same as the first, so the final string is
'go bob go'.
Sample code solution:
(Tap below to reveal)
drawBoxes('go bob go');
Grasshopper Concepts: drawBoxes()