# Game 1: Data Representation and Images

Last week we described our fall experiment, in which students in New Jersey played either an abstract or story-based version of three games that teach computer science concepts. In the next series of posts, we’ll describe each concept and game alternating with a summary of observations from playing the games.

In our first game, students learn about the computer science concept of data representation in the context of images.

### Computer Science Concept

All data is represented on a computer with numbers, be it a math equation, a text document, or an image. Data can be stored using any encoding we want, but we have to decide on a standard and stick to it. By remaining consistent, everyone can interpret the numbers the same way. Sometimes, we can find ways to represent the same data with fewer numbers, but this has tradeoffs: it takes less space to represent the same data, but it might make the encoding/decoding process more complex and sometimes information can be lost.

Learning Objective: Students should minimally understand that images can be represented as numbers, and that it doesn’t matter how we encode images as long as a standard is decided upon and applied consistently. As an additional objective, students should understand that there are techniques to compress information so that fewer numbers are required to represent the same data. In the case of images, an example is run-length encoding, where instead of listing the color of every pixel in a grid, we can list how many contiguous pixels of a certain color appear next.

### Game Rules

The full set of game rules used in our experiment is available as a PDF.

This game began as a Battleship-inspired call-and-answer game in which a player’s goal is to reveal their opponent’s image first.  Each player receives two grids: one blank one, where her image will be revealed over time by her opponent, and a hidden grid with an image filled in.

On her turn, Player A calls out a row number and column number.  Player B then takes one of the following actions:

• If the cell on Player B’s publicly revealed image is blank, the colour of the cell will be revealed.
• If the corresponding cell on Player B’s hidden image is a 0, Player B places a dot inside the cell on the revealed image to indicate that the cell is white.
• If the corresponding cell on Player B’s hidden image is a 1, Player B colours the entire cell with her pen to indicate that the cell is black.
• The player whose turn it is gets to call out a second bonus coordinate, which can be either the same cell or a new one. (Only one bonus call per turn is allowed.)
• If the cell on Player B’s publicly revealed image is already revealed as a certain colour, a run of cells directly to its right is also revealed until the colour changes, or the row ends.
• If the very next cell is a different colour, nothing new is revealed.

The goal of these rules was to get players used to the idea that images can be represented as numbers in a grid, and to start giving the idea that runs are special in that they can be “represented” all at once instead of individually.

We decided that the concept of runs wasn’t emphasized quite enough in the game, so two more “levels” of play were introduced. These levels are essentially races where players have to encode or decode images with varying protocols the fastest. In addition, we added a warm-up matching activity that helps students get used to the idea of images being represented as numbers.

### Game Story

In a role-playing scenario, students are brand new humanitarian aid workers charged with helping scattered refugee families in three camps escape their war-torn land—alive! Working with the images correlates to activities like reading and transmitting a map to fellow aid workers. The story outcome is tied to how well the players perform in the game. More information is available in the game rules document linked above.

### Facilitator’s Script

The story and abstract versions of the facilitator’s scripts are available for download.