Coding Exercise 1
Prerequisite Concepts | 7, 12 |
Key Concepts | 14, 17 |
Rather than using a single lace pattern (over and over again) in the construction of a lace, a lace can be generated by alternating between two or more lace patterns. We call the resulting structure an intertwined lace.
For example, suppose we are given two lace patterns L1 and L2. An intertwined lace can be constructed from these patterns as follows: First, perform one iteration of the L1 stamping pattern using a 1-bit brick as a seed shape. Then perform one iteration of the L2 stamping pattern using the artifact created in the previous step as a seed shape. Continue on in this fashion alternating between the L1 and L2 stamping patterns to construct larger and larger artifacts.
Figure 1 species an intertwined lace constructed from two stamping patterns.
The intertwined lace shown in Figure 2 is an implementation of the intertwined lace specification given in Figure 1. The colors in this artifact are the result of random brick selections which were accomplished using Bricklayer’s random brick function.
In this exercise you are to write a Bricklayer program that implements the intertwined lace specified in Figure 1. Your implementation should make use of Bricklayer’s random brick function to select the bricks in your artifact. Feel free to change colors and build a larger intertwined lace if you like.
Coding Exercise 2
Prerequisite Concepts | 7, 12 |
Key Concepts | 14, 17 |
Rather than using a single lace pattern (over and over again) in the construction of a lace, a lace can be generated by alternating between two or more lace patterns. We call the resulting structure an intertwined lace.
Figure 3 species an intertwined lace constructed from two stamping patterns. Note that these two patterns have different sizes.
The intertwined lace shown in Figure 4 is an implementation of the intertwined lace specification given in Figure 3. The colors in this artifact are the result of random brick selections which were accomplished using Bricklayer’s random brick function.
In this exercise you are to write a Bricklayer program that implements the intertwined lace specified in Figure 3. Your implementation should make use of Bricklayer’s random brick function to select the bricks in your artifact. Feel free to change colors and build a larger intertwined lace if you like.