Jay Little
9 min readJun 28, 2016

Boardgame Basics >> How Hobby Games Introduce Coding Concepts

The benefits of hobby gaming are vast and varied. One particularly interesting benefit is how hobby games teach basic coding concepts. I find this fascinating, not just as a gamer, but as a professional game designer, teacher of game design, and parent of two young gaming enthusiasts.

I’ve taught a variety of Video Game Design courses over the years. But I’m not a programmer or coder. It’s been more than a decade since I’ve done any CGI or PERL scripting. Yikes. But I can talk the talk in terms of the logic applied and the relationship between different pieces of data, and so on… because of my experience with gaming.

For me, no other game influenced this more than Magic: The Gathering. I’m a firm believer that if you can play Magic: The Gathering (or just about any other collectible or living card game), you are well on your way to understanding coding and the logic behind it. Even if you never touched a lick of code — even if you never see the Matrix in all those ones and zeroes — you understand the basics. Enough to really cut down the learning curve for a number of visually-based drag-and-drop game design programs like Game Salad, Game Maker, or Stencyl.

Here are the four key coding concepts I’ll examine. I’ll go concept by concept showing how hobby games can help teach them:

  1. Order of Operations
  2. Simple Expressions
  3. Boolean Expressions
  4. Conditional Statements

If you are a hardcore programmer, I hope you can appreciate that I’m using broader strokes to show these concepts and how they are expressed in these games.

Order of Operations

Almost every single game includes an example of Order of Operations in the turn order and player turn. Play generally goes clockwise, one player completing a turn, then advancing to the next, in order, until a condition has been met such as completing all the actions on your turn.

A more complex order of operations exists within a specific player turn. Many games feature a player turn that is broken down into more specific steps performed in a specific order. Sometimes these steps are broken down further into their own series of steps.

In the new edition of the popular tile-laying game Carcassonne, the rulebook illustrates the order of operations in a very clear way, marking them step by step in large, colored blocks. Step one is the first green block, followed by the blue block for step two and the red block for step three. In fact, the rulebook even highlights the conditions under which certain steps operate by bolding the condition (must, may) involved.

Portion of Carcassonne Rules (PDF from Publisher Website)

Simple Expressions

As it relates to gaming, I am using a simple expression to mean performing a specific game function to complete an “equation” or express a true statement that allows you to achieve a goal. If you do A + B you get C. Or, if you complete a quest and return to the city with the orc card, you get an item card and four gold. Some of these are more subtle than others and are woven into a narrative, such as when playing a thematic co-op game like Arkham Horror or Pandemic.

The wonderful game Fuse, by designer Kane Klenko, does a fabulous job showcasing these expressions — very literally — without even realizing it by making them a key unit of gameplay. The players are working together to defuse a bomb in real time (they have 10 minutes, and a timer that doesn’t stop while the players make their decisions) by rolling and distributing dice to place on the cards which represent parts of the bomb.

FUSE cards from BoardGameGeek image files

To complete a card, a player must fulfill the requirements on the card. They have to make the expression on the card valid with different dice combinations — some even require that the dice placed create a valid math equation. Place the proper dice in the proper places and the expression is true. Once the expression is true, the card is complete and the player can move on to the next card.

Boolean Expressions

In broad terms, one might say Boolean Expressions are a sub-set of conditional statements — which are actually the next step, so it may look like I’m getting ahead of myself, but stay with me. Boolean expressions look to a single state or value to see if it is True or False — a binary, mutually exclusive comparison. Each state is tied to a specific outcome or response. If the state is True, do this. If it is False, do that.

Games are filled with boolean expressions. Some are very clearly stated, as with many abilities in games with complex interactions like Magic: the Gathering. A lot of abilities trigger if a particular event occurred. So if the state “the event did occur” is True, then the ability triggers. If it is False, the ability does not trigger.

There are also a number of traits that cards can have that create a sort of shorthand language to help determine this True or False state. A trait is a meaningless descriptor — until another game function is looking for that specific descriptor to fulfill a boolean expression: if they have this descriptor, the expression is True, and do this. If it does not have the descriptor, it is False.

from gatherer.wizards.com

In the Goblin Glory Chaser, it has two key traits listed next to its Creature card type — Goblin and Warrior. By themselves, they mean nothing. But if the player has another card that says “All of your goblins gain First Strike” then the Goblin Glory Chaser would gain First Strike because he has the Goblin trait. Therefore the boolean expression is True and fulfills the condition, so the ability triggers.

The two other abilities, Renown and the following ability, are both based on boolean conditions. Renown only triggers if it isn’t already renowned — the ability looks to see if the card’s renown status is True or False. The second ability works the same way, checking to see if the card’s renown status is True or False.

Conditional Statements

Boolean expressions are just one type of conditional statement. Other conditions exist, such as rules or characteristics that operate while, until, or if, another event triggers some sort of reaction. Consider the typical game, the default way a game is played. Everything is going just fine then BAM, a card is played or a character with a special ability decides to do something. So you play by the standard rules until a new rule says otherwise.

Munchkin by Steve Jackson Games is a great example of a game using conditional statements to operate, override, and interfere with its own set of rules. In fact, right in the rules, there is an inset that describes what happens when there is a conflict between text on cards and text in the rules. It lists a series of conditions — Follow the standard rules unless this occurs. Text on cards overrides the rules in the rule sheet except in these cases.

from Steve Jackson Games website

And there are a bunch of individual cards that have special text which tells you when the card can be played. Often, cards require some sort of trigger to bring into play — a conditional statement to fulfill (such as after another game effect occurs). Others list all the ways in which they override the default rules of the game (play the standard way until you encounter “Cheat With Both Hands” then, throw everything out the window…)

from Steve Jackson Games website

Munchkin also showcases two other important coding concepts. Syncing your data and writing clean code. Munchkin is a marketing and sales juggernaut with 23 core sets, 6 deluxe sets, and about a gazillion special promotional cards and items.

Each Munchkin set is playable completely independent… but they can also be combined. How on Earth is this possible? Synced data and clean code. At some point, someone had to decide to come up with a common language for describing certain game terms and effects — do you gain experience or levels? Do we call them turns or rounds or phases? Are they characters or players or player characters?

It’s important to have a common language with clear focus that doesn’t require the original programmer to be present to translate — so someone else can sit down and use the code. The original designer of Munchkin doesn’t have to design every card and every set… the code is clean enough and flexible enough that anyone can program a Munchkin card. And they do — Steve Jackson Games accepts card submissions on their website!

De-Bugging

I’ll even throw in a bonus concept that hobby gaming teaches for free… De-Bugging.

As a game designer, playtesting has taught me a lot about de-bugging. The entire playtest process is built on de-bugging. Just like video games, board games go through alpha and beta testing — sometimes open to the public, sometimes not. But invariably they find errors, mistakes, broken systems, unbalanced abilities, inaccurate math, and other problems. Things that bring the system to a screeching halt.

Sometimes I have to go back to my “game design code” and go through it, line by line so to speak, and try to find out where I went wrong. Was it something significant, or the equivalent of having a semicolon where I should have had a period?

It’s an essential process because nothing is 100% accurate, 100% perfect the first try. I’ve never designed a game where the very first attempt is what went to the printers and got shipped out the door. The same with programming. Things change. You have to adapt and find new solutions and workarounds. You have to streamline code. Fix problems. Find solutions to problems you didn’t even know existed — or problems you created by fixing other problems.

There You Have It…

So there you go. Hopefully I’ve been able to share not only how passionate I am about gaming, but one of its many values in learning — in this case, how an understanding and appreciation of hobby gaming has many parallels to the basic concepts of coding and programming.

I’ve only scratched the surface, and only with a handful of games. There are dozens of wonderful games that could be used — the ones I selected here were chosen because they are easily accessible and make for easy reading and description in article format. As an educator, there are a number of games for students from pre-K through high school that could be used to show these concepts.

Ticket to Ride, Make n’ Break, Codenames, Settlers of Catan, Pandemic, Forbidden Island, Seven Wonders, Tsuro, King of Tokyo — just about any game features elements that showcase at least one of these coding concepts. If you’re interested in finding these games, I’d recommend getting in touch with your local game store, or more and more book stores like Barnes & Noble are carrying games these days.

.

Jay Little is an award-winning game designer, teacher, and hobby gaming enthusiast. Over the years he has worked with a number of big name publishers and with a number of big name licenses, including Major League Baseball and Star Wars. He also teaches game design and design thinking at UW-Stout in Menomonie, Wisconsin and travels extensively to share his experience and passion for gaming with audiences across the country.

Jay Little

Award-winning game designer, teacher, and gaming enthusiast. A professional geek who shares his experience and passion for gaming with people around the world.