Quarry School

Decode a tiny bitmap — quick review

In plain words

Imagine leaving a note for a friend about two squares side by side on a calendar.

Rule

The paper format is the set of rules that tells you how to read the bits. It gives you the width, height, colour key and reading order. Both dimensions are whole numbers of at least one. Multiply the width by the height to count the squares. You need exactly that many bits, including every 0.

For the two grids shown here, the key is 1 for ink and 0 for white paper. Start with an all-white grid and the first bit. Work across each row from left to right, starting with the top row. Stop when you use the last bit in the bottom-right square.

Step

  1. Draw the given number of columns and rows. Leave all squares white. Count the squares and the bits. If the counts differ, stop before shading and report the two counts.

  2. Start at the top-left square with the first bit. Use the key to decide whether to shade the square or leave it white.

  3. Use the next bit in the next square to the right. At the end of a row, move to the leftmost square of the next row down if there is one. Stop after you use the last bit in the bottom-right square.

  4. Read the drawing back from the top left in the same order. Use the key to write one bit per square and join the rows into one line with no spaces.

Trap

Use the width to decide where to end each row. Grid A needs three bits across each of its two rows. If you use the height of two as the row length and lay out all six bits, the third bit starts a new row and you get Grid B. Check the key as well. If you swap what 0 and 1 mean, every ink square becomes white and every white square becomes ink.