Your Task

  1. Go to the custom code environment.

  2. Solve as many of the “lab” puzzles as you can during the lab time (or in a roughly equivalent amount of time outside of lab).

    For each puzzle, you can write a series of C-like statements using only 32-bit ints, following the restrictions in the puzzle.

    We expect everyone to complete first two puzzles, and almost all to complete the first three. We expect very few students to attempt all six puzzles within the lab time.

    (For the lab, you do not need to complete all the puzzles; we intend to give full credit as long as your submissions to the coding environment are consistent with spending an appropriate amount of effort on the puzzles.)

  3. These puzzles should help you understand the following homework, which, unlike the lab, must be completed individually and its entirety.

Notes on the C-like environment

  1. You can create new variables by assigning to them like int y = x + 1; or just y = x + 1;. (Since all variables are ints, you don’t need to specify types.)

  2. Integers use two’s complement.

  3. Since all values are ints, all shifts are arithmetic.

  4. You cannot use control flow constructs like if or while.

  5. You can generally omit semicolons if you want.

Hints

Specific advice for the puzzles

thirdbits

bang

isequal

bottom

islessorequal

bitcount