An Encoding Scheme Puzzle
File types and other metadata indicate how bits should be interpreted to recreate an image. An encoding scheme describes the manner in which a file organizes its constituent bits. There are a variety of encoding schemes that computer scientists utilize for different purposes. Watch this video, which explains image representation in terms of a run-length encoding scheme:
"For example, consider a screen containing plain black text on a solid white background. There will be many long runs of white pixels in the blank space, and many short runs of black pixels within the text. Let us take a hypothetical single line, with B representing a black pixel and w representing white:
If we apply the run-length encoding scheme to the above hypothetical line, we may interpret this as the following:
B’, and 12
The run-length code represents the original 37 characters in only 16 (22 if you include spaces for clarity).
5w 1B 5w 3B 10w 1B 12w
Of course, the actual format used for the storage of images is generally binary rather than ASCII characters like this, but the principle remains the same. Even binary data files can be compressed with this method; file format specifications often dictate repeated bytes in files as padding space.” (Run Length Encoding, Princeton University)
Play the Picture Logic Game
Navigate to the Picture Logic game, which is based on the run-length encoding scheme, but complicates it slightly. In this game, you will interpret numbers in order to decode an image, much like a computer does.
- Read the How to Play Picture Logic tutorial.
- Navigate to the Picture Logic game.
- Attempt the first “How to Play” challenge. What image are you drawing?
- Continue to complete puzzles until you get stuck.
- After you complete at least three successfully, you may attempt other Picture Logic games, including Colorful, which adds the complexity of multiple colors to the puzzle game.
- Discuss the following questions as a class when everybody has completed a few puzzles:
- How are the encodings the same or different from run-length encodings?
- Why wouldn’t a game using just run-length encodings be challenging?
- Why do you think fax machines use RLE?