It's school holidays as I type this, which means I've been out of the office keeping kids entertained rather than doing anything interesting with code. But all is not lost – because it leaves time for playing some games instead. That reminded me of a conversation I had at Sitecore's Symposium last year about "games I like because they appeal to me as a programmer" – so I thought I'd make a list of the stuff I've enjoyed wasting time with in the last few years (When I've not been playing Minecraft or Terraria with my eldest), in case they appeal to anyone else...
Over the years, one developer has produced a collection of games-related-to-programming that I've enjoyed – Zachtronics. The first couple are games really appeal to the low-level nerd in me:
I was never a serious assembly language programmer for whole applications, but back in the day I used to put bits of in-line assembly code in my Turbo Pascal projects – when raw speed was the order of the day. (And yes, I appreciate this may not be normal 😉 ) The game TIS-100 is a bit of a throw-back to that. You have to solve coding puzzles using a set of interconnected simple CPUs and memory chips. You're given information about the inputs and outputs required for the overall system, and then you get to work out what code should run on each CPU to solve the problem. Largely it' a puzzle about how how you need to shuffle the data between the CPUs to get the right results, and how you can express your idea in short enough chunks of code to fit in the memory of the really simple CPUs.
The puzzles start out fairly simple, with things like sorting and filtering data, but they end up with more complex ones involving generating images. Passing level relies on getting the right outputs, but your attempts are also scored on things like how many execution cycles they need to finish.
The UI is pretty basic, but it's styled to fit with the low-level nature of the game (and there's a sort-of plot tying it all together), but the fun for me is really about making the code work.
The "big brother" of TIS-100 adds a bit of electronics into the mix. You get to choose how to connect up different types of CPU and other components, before adding the assembly code to make a device to meet a specification you're provided. The CPUs are more complex in this version, and have different sorts of inputs and outputs to wire together and process – so there's more to think about in solving the problems.
I have a suspicion that part of the reason this appeals to me is that it's pretty much what I spent my time at University doing. I spent four years studying how to build up computers from first principles and then write code for them – and while I'll admit I've probably forgotten 90% of my electronics skills through lack of use, being able to beat these levels makes me think I've not lost it altogether...
From the same company, but in a slightly different vein is:
This was actually the first of the Zachtronics games I came across. It's not really about code – it's a puzzle about making chemicals. But the solutions to the problems are sort-of-programs. Each level is a grid that has two inputs and two outputs. You have to set up how a pair of manipulators can move across the grid, carrying atoms around to construct the chemicals. You move atoms from inputs, bond them together, rotate the results and drop them on the outputs. The route that the manipulators take, and what actions they perform are up to you, but you have to ensure atoms don't bump into each other – so the commands you can "program" include things like synchronising the two, so they stay in step and don't crash.
Simple puzzles start with "turn hyrdrogen and oxygen into water", but the more complex ones involve multiple stages where you have to design the reaction for each stage – breaking one chemical down into atoms and reassembling the results into other things.
[There's also a fancier version of this concept that is rendered in 3d called Infinifactory if you fancy a similar challenge]
This style of "automate the production of stuff efficiently" has been done in other ways by other developers. The two I've played most in recent months are:
Your spaceship has crashed on a planet. There are resources to mine, which you can use to make more tools. These can get you more resources and ever more complex tools and machines. And you also have to defend yourself from the planet's alien life. Can you work your way to the top of the technology tree, build yourself a rocket and escape? If you ever played Transport Tycoon (You still can, btw – there's a great open source recreation you can download) back in the day, this has a similar "connecting up the world" vibe – as you join up your your mines, factories and machines with conveyor belts, railways and even flying drones...
I've lost days of my life to this – I find it rather addictive. You start off having to micro-manage the mining and refining of initial resources, but as time goes on you have to automate more and more, and the challenge becomes more about ensuring resources get to the right places and your machines are working efficiently. Some people have built insanely huge and complex factories.
As I write this, Factorio is still in "Early Access" and under active development, so features, graphics and balance are being adjusted. But I still find it great fun.
In a more down-to-earth style, this is a game about building huge and efficient car factories. As I write this, it is also still in development, (and less polished than Factorio) but it's already worth a look. The pre-release version you can get right now has the basics of research, different car types, assembly and market economics. The future roadmap includes more complex economics, marketing and a wider range of car styles and options to research and build.
A sort-of-similar thing which is focused on a humorous take on the world of drug companies is Big Pharma – it's published by the same company as Production Line, but developed by a different person.
There are some slightly more off-the-wall games which involve computer stuff too:
Another genre of games I've really enjoyed over the years are point-and-click adventures. While it's not quite up to the level of the old LucasArts classics, this is an interesting adventure, where code is key to completing it. You can literally "hack the world". Once your character has acquired the right tools, you can use simple basic-like code to change the properties of the world around you. Need into a room with a combination lock? Can't find the combination? Then write code to brute-force the combination for the door...
As well as the entertainment, there's more educational stuff too:
Not actually a game this one – but a series of maths puzzles which you can try to solve via your coding tools of choice. You get a problem, explained with examples using small numbers that are easy to compute. But to "solve" a puzzle then you have to work out the answer to a much harder variation that will require efficient code and clever optimisations to solve in a reasonable time. For example, this one revolves around the 1000th Fibonacci number. The website will check your answer, and keeps track of the problems you've solved.
If you enjoy maths, it's great as a set of problems for teaching yourself new programming languages. I spent quite a bit of time trying to solve puzzles from here using F# a while back...
If you're interested in coding puzzles and exercises, but you're not so into maths, then you might like:
This website has programming puzzles (and a fancier looking UI) which you can solve in your browser. It supports writing your answers in a variety of languages (including C#) and provides pretty pictures and the unit tests that prove you've got the right answers to the problems. If you're feeling competitive they have regular challenges to take part in, where you can compete against others for faster / better solutions.
And finally, on my "tinkered with it for a couple of hours, and plan to go back to it" list:
So that's a few games I've enjoyed – do you have other stuff you'd recommend?
[09/2017] Edited to add: I found another game for my collection:
It's in a similar vein to Shenzhen-IO, but it's entirely focused on the electronics side. You solve puzzles by building up circuits with things like wires, adders, latches and RAM – something I spent a lot of time doing in my youth, but haven't touched for years. Nerdy but awesome...