Serendip is an independent site partnering with faculty at multiple colleges and universities around the world. Happy exploring!
Reading Like a Computer
This is an analysis of a project I did for my class Intro to Data Structures. This analysis is supposed to examine the ways in which computer reading and processing of information is different from human reading and processing of information.
I will be examining three components of the game: the game file I created, which contains simply formatted information about the different aspects of the particular game; the game engine, which takes information out of any game file, processes it, and presents it as a game; and the way the game presents itself to and is used by the player. I have included Wordles of each of these components, as well as sample screenshots of the text, in order to help the reader understand them.
The Wordle of the game file:
As you can see, Wordle didn't process the game file very well. It left in the double colon marks that the game engine uses to split each line. It still helps to distill the information in the game file, though.
A screenshot of part of the game file:
The game file contains the information for the particular game I wrote, called “Apartment Escape”. Each line contains information on a particular aspect of the game—a room (called a node), a way to get from one room to another (called an edge), an item that the player can pick up and use in the game, and other components. To the human eye, it looks like gibberish, but the game engine knows how to process it.
The Wordle for the game engine (This Wordle was created with the "remove common words" function turned off to make the representation more accurate, but notice the distinct lack of the word "the," which code does not typically use.):
A part of the game engine:
The game engine takes the information from the game file and interprets it. It takes each line of the file and determines what kind of information that line contains. Then it saves the information in a temporary, alterable state within the game itself, so that actions the player takes are remembered but do not alter the file for the next player. Then the engine asks the player for input from the player, and evaluates what should be done based on which simple commands the player inputs and the logic of the game.
The internal logic, as you can see from the Wordle, is based largely on "if" statements. Some of these "if" statements rely on components outside the player's control, like their health. As you can see from the code snippet above, if the player's health goes below zero, they die and the game ends. Most of the logic, however, depends upon the "command" that the player entered. The logic pulls the command apart and checks to see whether the command has to do with picking up or dropping an item, moving from room to room, or something else.
The Wordle for an entire play-through of the game:
How the game looks when it's played:
The game presentation is meant to be interpreted by a human. It uses natural words and phrasing. In the display above, the blue words are what the game prints out, and the black words are the commands entered by the player. The game displays the information for the room the player is in, including whether there are any items that the player can manipulate in the room. The player then decides what action to take. As can be seen from the Wordle, the "Command"s are very important. Without the player's input, the game would not go anywhere.
These three modes, the game file, the game engine, and the game play, are meant to be interpreted in different ways by different "readers." The game file, with its great blob of text seperated by the double colons, is mostly in English, but would be difficult for a human reader to put in a sensible and cohesive order. Instead, it is interpreted by the game engine, uses its logic to sort through the information in the game file and the player's commands. The game engine is in turn read by other code interpreters on the computer. The end product is the playable game, which presents the information the player needs to use and enjoy the game in a way that makes sense to the human.
Each layer is subjected to a different "reader" and each is in the appropriate format for that reader. The reader, whether it is human or code, needs information it knows what to do with.