Level 2 coding studies correspond to Vitruvia concepts 10 – 13.

Reading

  • Sets – learn some of basic concepts about sets.
  • Types and Values – learn about primitive types, values as well as some of their operations. Variables, names, identifiers, tokens and spaces are also discussed.
  • Nullary Functions – learn how to declare your own functions.
    • A powerpoint presentation that animates how nullary function declarations and calls can be introduced into a Bricklayer program can be found here.
  • Offsets – learn how to manipulate Bricklayer’s coordinate system.
  • Parameterized functions – learn how to create a function declaration parameterized on a 2D coordinate.
    • A powerpoint presentation that animates how nullary function declarations can be transformed into parameterized function declarations can be found here.

Code-Along

Coding Exercises

  • Concept 10 – For lengthy put2D_* function call sequences, comprehension becomes a problem. Nullary function declarations (i.e., functions taking essentially no arguments) can be used to structure and abstract function call sequences. Such structuring of Bricklayer programs makes them easier to understand, to debug, and to modify.
  • Concept 11 – Offsets provide a Bricklayer mechanism for shifting the origin of the xz-plane. Through offsets it becomes possible to reuse a (single) sequence of put2D_* function calls in order to build copies of LEGO objects positioned at various points in the xz-plane. Offsets share similarities to pointers and are (understandably) quite complex.
  • Concept 12  – In Bricklayer, function parameters can be used to play a role similar to offsets. However, function parameters are essentially stateless and are therefore (ultimately) much easier to understand and reason about than offsets. This distinction between offsets and parameters illustrates a fundamental difference between imperative and functional programming paradigms. Through parameterized functions, it becomes possible for users to extend the set of put2D_* functions thereby creating specialty composite pieces (e.g., L-shaped bricks and nxm bricks).
  • Concept 13 – In Bricklayer, the fundamental brick has dimensions 1x1x1. However, Bricklayer also provides functions that construct (and “put”) composite structures such as circles and rings.
  • Survival – In survival mode you are asked to construct artifacts using only bit-bricks.