The Minisculus Challenge – Winner Announced!

On Friday 7th October, at Software Craftsmanship 2010, eden announced Minisculus – a series of encoding, decoding and code breaking challenges, loosely based on the historic challenges faced during the second world war.

Minisculus SpyMinisculus was set by Steve and Todd. I took the challenge in the week before SC2010 and really enjoyed it. There is enormous satisfaction in figuring out the answer, posting it to the server, and if you got it right, receiving the secret URL to the next question. The progression of the challenge provides new insights and plenty of opportunities for refactoring to keep your code clean and simple.

We ran Minisculus as a competition for a £100 Amazon voucher. We had 12 entries; most written in Ruby, but also including solutions in Java, Clojure, PHP and Python. It is fascinating to see the different ways that people implemented their solutions.

Luke RedpathOur winner is Luke Redpath, who is a freelance Ruby and iPhone developer in London. Luke wrote the solution in Ruby, nicely specified using RSpec. The code is particularly clean, easy to read, well refactored to be very simple. Luke has good use of object orientation, using a ShiftCypher that can accept any number of wheels, which have their own configurations for encoding and decoding, a great example of the Strategy Pattern. Luke also included a code breaker using keyword matching, and automated the communication with the Minisculus server to send answers and receive the next question.

Luke’s was also one of the first entries we received, and a nice little touch helped seal it for Luke: the inclusion of a MarkIII machine that raises an exception when called: “Not Implemented due to budget overruns!” – a joke that shows the attention paid to the story told by the challenge. Have a look at Luke’s code at

You can see a Hall of Fame on the Minisculus website, showing everybody who completed the challenge, including source code for many of the entries.

Although the competition is now over, the challenge remains for anyone who wants to try it! Thanks to everyone for participating so far!

Computer generated art

I woke up yesterday with a simple idea for generating a picture based on an input string. I don’t exactly know where the idea came from, but i think i’ve been influenced by Nick Huggins, whose abstract work i adore, and also in a way by QR codes. I’m not a particularly artistic person, but i figured i could come up with an algorithm and let the computer do the creative bit for me! :)

So i installed the open source tools ImageMagick and RMagick, learned a bit about the RVG library, and set about trying some ideas. I fiddled and tweaked the algorithm until it seemed to consistently output something that was reasonably pleasant. Here is the picture for my name, and for my twitter id.

aimee @sermoa

Having tried random numbers and obvious inputs like my name, i searched for other input sources. Being interested in community generated content, i wrote a script to fetch the current top twitter trends. Here are the results.

Kim Hee Chul Solomon Burke Steamed Bun #thingsyoushouldntsay HEEBUM
#badsongsinjail Limera1n Aiden #bsr_tousounow One Direction

As you can see, some come out better than others. I’m adding the input string mostly for debugging purposes so that i can see how the image was seeded. When i get one that i like, i can increase the blur and remove the input string. For example, i really like the images produced by “Kim Hee Chul” and “#bsr_tousounow”, so let’s try with a bit more blur.

Kim Hee Chul (with more blur) #bsr_tousounow

Nice, hey?! Not sure they’re ready for a gallery just yet, but certainly an interesting experiment.

Everything in the picture is generated from the input string: the size, colour, number of boxes, box sizes, opacity, border style. It is extremely unlikely that any two input strings would ever generate the same picture. However, the algorithm is not random. Given an input string, you’ll always get the same picture, though i may choose to do some post-processing on it (such as blur, frame, lighten or darken).

In the interests of sharing knowledge here is the main structure of my generator, but the really creative part is in how it comes up with the numbers, which is going to remain a secret, sorry!

I am willing to generate images for anybody who asks nicely! :)

Software Craftsmanship 2010

Today i had a great day at the Software Craftsmanship 2010 conference at Bletchley Park. Despite getting up ridiculously early, and feeling somewhat ill during the day, i managed to have an excellent time, learn a few things, and chat to some wonderful, interesting people.

I enjoyed Jason Gorman’s enlightening tutorial on refuctoring – the art of incrementally changing code a little at a time, so that the tests still pass but it becomes less readable and less maintainable, to the point where only you have a clue what the code does. Sometimes known as Mortgage Driven Development, because it claims to ensure you keep your job. Jason encouraged to look for Code Smiles (well-written, elegant code) and refuctor them away effectively. I enjoyed pairing with Gavin on making the ugliest “Hello, World!” we possibly could!

As an antidote to the refuctoring, several people went to the workshop on beautiful, maintainable, Designer Code by Chris, however i chose to attend Michael Hunger’s Game of Life session. After the recent code retreat at eden, i was eager to learn more about the Game of Life and Michael showed us a video of John Conway talking about the Game of Life, and an implementation of the Game of Life in APL which is mind-blowingly awesome! I worked with Chris and Iain to do a version of the Game of Life in Java. I think we had an hour to do it, and we very nearly got something that worked, except we weren’t calculating the neighbours correctly so every cell died, prompting us to rebrand it as The Game of Death!

A special highlight of the day was the guided tour of Bletchley Park where we saw the places where secret codes were intercepted and decoded in World War II, and saw the impressive machines that were built to apply brute force to crack the encoding strategies. What impressed me most was how innovation was driven forward by necessity, and it made me smile to learn that the codebreaking was usually made possible thanks to stupid mistakes that were made by those transmitting the codes.

With a nod to the Lorenz encoder and the Colossus code breaker, eden launched the Minisculus Challenge today. I hope a few people have already tried the challenge and are enjoying it as much as i did! It was hard keeping it a secret last week, when i really wanted to tweet about it!

In the afternoon I went to David Laing’s workshop on Functional Kōans. I paired with Adam and together we did the kōans in javascript, learning quite a few tricks along the way.

I had a very good day, and i thank Jason, all the workshop facilitators, and everyone who helped to make the day such a success!