Tyler Benziger

Gitwar: Gaming with Git

May 10 2013

I recently came across a blog post that talked about non-developers using Git and GitHub to do some pretty cool things. It got me thinking about other cool and unusual things possible with GitHub.

Then I started thinking about games and wondered what it would look like to have a game with Git at the center. Not something as lame as “who can create the most branches with the most inappropriate names in the shortest amount of time?” More like a family of two-player, head-to-head, text-based, turn-based games with Git as the transfer protocol.

So I made one, and I did it all in BASH.

The games are built using a “platform” called Gitwar. It’s a shared utility that takes care of adding, committing, pushing, and pulling to/from the shared repo.

The first game is called Gitfight and it’s an incredibly simple/corny game where you tell the game what kind of punch you’d like to throw at your opponent and basically roll a virtual die to see how much damage you deal. After you submit your punch, Gitwar takes over and commits that action to your repo and your opponent can have a chance to punch back.

The second game was an obvious choice. It’s called Gitchess. This is where I had the most fun. Creating a more complex game in BASH proved to be a difficult but satisfying challenge.

It was really fun to make, and I’m eager to find out what other types of command-line games can be built on top of a pattern like this. Be sure to check out the Gitwar repo here. And give me a shoutout on Twitter if you have comments.