Programs Are Games, Programming is a Game
This post was originally published on blog.charliemeyer.co
In 11th grade, I wrote my first program, Dingo Hopper. In the game, the player controls a png of a dingo as it jumps over gray boxes. Dingo Hopper was not fun, or a commercial success, but it was a game.
What is a Game?
I’ll take the following definition of game from Wikipedia:
"At its most elementary level we can define game as an exercise of voluntary control systems in which there is an opposition between forces, confined by a procedure and rules in order to produce a disequilibrial outcome." (Elliot Avedon and Brian Sutton-Smith)
Basically, in a game, a player does stuff according to the rules of the game to make something happen. In this sense, Dingo Hopper is certainly a game. The player voluntarily presses the “hop” button to counteract the powerful force of the onslaught of gray boxes headed in its direction. They do this with the goal of admiring the wonderful background scenery that I created in MS Paint.
What about the ls
command (list files on your computer)? What about Jira? What about Python?
What is a Program?
I’ve tried to define the word program in a previous post, but let me try again, in one sentence.
A program is a set of rules for converting input into output.
Programs need not be fun (see: Jira), or interesting, or important, but they need to have rules and they need to produce output.
Programs are Games
When running a program, a user exercises voluntary control over the input they give it. They can make ls
sort files in ascending order according to created date, or show files in a different directory, or give garbage input that will be rejected. ls
uses its rules to provide the corresponding output for this input, either a list of files or an error message that the input was invalid. This is our disequilibrial outcome, in the sense that the user has won a list of files on their computer. Other programs have different outputs, but the essence is the same.
Programming is a Game
What about Python? Python is a programming language, and is a program in the following sense:
Python converts input (code) into output (a program).
So, Python is a program, and programs are games, so Python is a game. Yes, we’re stretching definitions to get here, but now we can ask an important question about this game.
Is programming fun?
My answer, and maybe this is the reason why I spend so much time on coding education, is that I think that programming is probably the most fun game that there is.
In playing most games, you are an actor exercising your “voluntary control” to create some outcome, like winning, or losing, or making a nice metropolis in SimCity. While these are nice outcomes, they pale in comparison to creating a program, a way to map the universe of all possible inputs into outputs, each of which can provide its own satisfaction. Programming is about not just following rules to achieve outcomes, but following rules to create a program in which someone else can follow your rules to produce their own outcomes. [1]
The only limit to the value of your finished program is patience and time spent debugging. If you’ve programmed for a while it’s a bit easy to lose sight of how crazy this is and to lose sight of how programming differs from almost every other endeavor.
Getting more players for the game
There are many reasons to advocate for teaching more people to program but to me the purpose is to introduce people to this game of games because of its uniqueness among all other activities. To make this happen, we need to think about how to teach the rules of the game, and to communicate why it’s so special.
Abstract arguments like those given in this post won’t convince people to try programming. What we need are programming languages that are more learnable, and accessible ways of teaching their rules. More importantly, we should make it easy to produce programs which themselves are fun. The output of these efforts can help more people discover the only game more fun than Dingo Hopper.
[1] If this wasn’t enough, the program you create can also be a programming language itself. This is the act of following rules to create a program in which someone else can follow your rules to produce a program whose rules govern how someone else’s input turns into output. This is a mouthful, but this is awesome.