There are two types of coders. The kind who do beautiful, well organized, and efficient work, and the kind who mash things together until they get a mostly-workable, very bugged piece of code. The first kind of coder is by far the more useful and professional type, and what we should all aim to be. However, being the second kind is often fun.
I was doing an Hour of Code project and it was terribly boring. Way too basic. So I ended up doing things like this:
It’s not a graceful solution. After nine seconds, my browser started lagging because there were too many Tauntauns and Mynocks running about. However, it was effective for the short term goal of beating that level.
I finished the 15 levels and decided I couldn’t write a blog on it. So I went to find something more interesting. I found this game: Untrusted
It’s awesome. And really challenging. And really simple. Here’s the first level, and how it works:
I mean, how did I find that solution? A little bit of trial and error, and some informed guesses about what the code was saying. Here’s another level, where I again went for the messy, but ultimately effective, solution:
A fun note on the messiness of code:
As they do in the comic, check out Google’s source code. Just go to Google, right click, and hit “View Page Source.” Spoiler alert: you’ll see something like this:
A very good Sci-Fi author (in my mind, the best actually) is Vernor Vinge. In some books, he points out how code has a way of building up to the point where we can no longer manage it. Characters in his worlds have jobs like Programmer-at-Arms and Programmer Archaeologist. The first is a position on a military ship – they fight through programming. The second tries to dig through old code and look for booby traps and prizes that have been lost. There is no starting fresh – all of our code is now based on older code, which is based on older code, and so on down. Terrifying to think how messy the baseline code might be – just look at how poor my solutions were above. If those get incorporated into higher levels of code, my work here could cause bugs for centuries to come.
I really recommend, if you’re interested in coding and puzzling around a bit, that you try Untrusted. And then tell me how high a level you manage 🙂