Level 3 – Concept 15 Exercises

Coding Exercise 1

Prerequisite Concepts 7, 12
Key Concept 14, 15

The diver down flag (or scuba flag) is a square red ag with a white stripe running from the top-left corner to the bottom-right corner of the ag. It is used in North America to signal that a diver is in the water and that boats should steer clear of the area for the safety of the diver. The diver down flag was designed in 1956 by Denzel James Dockery and is used predominantly in North America. The ALFA (alternately spelled ALPHA) flag is the international maritime ag whose meaning is “I have a diver down; keep well clear at low speed”.

Use the put2D and lineXZ functions to build a diver down ag similar to the one shown below. Before building this artifact it is recommended that you complete all Vitruvia exercises for Concepts 14 and 15.

15_01


Coding Exercise 2

Prerequisite Concepts 7, 12
Key Concept 15

Use the lineXZ function to build a spiral similar to the one shown below. The easiest way to accomplish this is to create a function, called revolution, whose body consists of four calls to the function lineXZ which collectively build one revolution of a spiral. In order to reuse this revolution function to build smaller/larger revolutions, it must be parameterized on an integer n denoting the length of the largest side of the revolution it is to construct as well as a coordinate (x, z) indicating where the revolution should be constructed. Through these two parameters it becomes possible to position a revolution of a given size at a given location. It is also useful to parameterize the revolution function on the brick to be used when building a revolution. A multi-colored spiral can then be created by a sequence of calls to the function revolution.

Before building this artifact it is recommended that you complete all Vitruvia exercises for Concept 15.

15_02


Coding Exercise 3

Prerequisite Concepts 7, 12
Key Concept 15

This study uses the lineXZ function to create a pattern consisting of triangles. Use a geometric algorithm (similar to the one used to create chessboards and grids) to create larger and larger triangle patterns. The pattern resulting from the first iteration is shown in Figure 1. The pattern resulting from the second iteration is shown in Figure 2, and the pattern resulting from the fifth iteration is shown in Figure 3. Write a program that builds a LEGO artifact similar to the one shown in Figure 3. Notice that this artifact is similar to the Sierpinski gasket.

Before building this artifact it is recommended that you complete all Vitruvia exercises for Concept 15  and that you complete the geometric decomposition code-along.

15_03_a
Figure 1: The first iteration of the triangle pattern.
15_03_b
Figure 2: The second iteration of the triangle pattern.
15_03_c
Figure 3: The fifth iteration of the triangle pattern.

Coding Exercise 4

Prerequisite Concepts 7, 12
Key Concept 15

This study uses the lineXZ function to create an alternating pattern of squares and diamonds. Use a top-down geometric algorithm (similar in spirit to what was discussed in the geometric decomposition code-along) to create a sequence of smaller and smaller square-diamond patterns. In the artifact shown below, the side of the largest square is 129. Note that the length of a line from 0… 128 is 129. Furthermore, note that all diagonal lines are as smooth as possible.

Before building this artifact it is recommended that you complete all Vitruvia exercises for Concept 15 and that you complete the geometric decomposition code-along.

15_04

 

 


Coding Exercise 5

Prerequisite Concepts 7, 12
Key Concept 15

This study uses the put2D function to create a variation of a chessboard pattern. Use a top-down geometric algorithm (similar in spirit to what was discussed in the geometric decomposition code-along) to create the pattern shown in Figure 3.
Figure 1 shows the first (most coarse-grained) approximation of the pattern and consists of two black squares (with side = 64) laid out in a diagonal pattern similar to a large 2×2 chessboard with the white squares empty. The second approximation, shown in Figure 2, adds additional diagonal squares to the empty portions of the 2×2 chessboard pattern. This idea continues until the pattern shown in Figure 3 is created.

Before building this artifact it is recommended that you complete all Vitruvia exercises for Concept 15 and that you complete the geometric decomposition code-along.

15_05_a
Figure 1: First (black) “crumb” in the top-down decomposition.
15_05_b
Figure 2: After the eects of the second (red) “crumb” in the top-down decomposition.
15_05_c
Figure 3: After the eects of the fourth (yellow) “crumb” in the top-down decomposition.

Coding Exercise 6

Prerequisite Concepts 7, 12
Key Concept 15

This study uses the lineXZ function to create an alternating pattern of right-side up and upside down triangles. Use a top-down geometric algorithm (similar in spirit to what was discussed in the geometric decomposition code-along) to create a sequence of smaller and smaller triangle patterns. In the artifact shown below, the side of the largest triangle is 257. Note that the length of a line from 0…256 is 257. Furthermore, note that all diagonal lines are as smooth as possible.

Before building this artifact it is recommended that you complete all Vitruvia exercises for Concept 15 and that you complete the geometric decomposition code-along.

15_06


Coding Exercise 7

Prerequisite Concepts 7, 12
Key Concept 15

This study uses the lineXZ function to create a pattern where the centers of four squares form the corners of a larger square.

Before building this artifact it is recommended that you complete all Vitruvia exercises for Concept 15 and that you complete the geometric decomposition code-along.

15_07