Afterwood

Afterwood

By Chris Oldwood

Overload, 29(166):24, December 2021


Players in Escape Rooms are set puzzles to be solved in order to win. Chris Oldwood reminisces on old childhood games as inspiration for various programming puzzles.

As I write this, the number one show on the popular streaming service Netflix is called Squid Game, a South Korean drama where hundreds of adult contestants compete in a deadly series of children’s games for a life changing sum of money. Naturally, the meme generators are working overtime and I can’t help but be seduced by thoughts of how you might apply the premise of the show to our own profession. The show has a somewhat macabre element, which I’d rather not dwell on in a family friendly publication such as this, so maybe The Crystal Maze would be considered a better format. However, if it’s children’s games from my era [Wikipedia-1] we’re after then I’d need to regress a few more years back into the mid ’80s BBC Archives where we meet its spiritual successor – The Adventure Game. This show was set on the fictional planet of Arg, which feels like the perfect place for programmers to battle it out.

This also feels like the ideal topic to start testing our contestant’s mettle – passing arguments. The scenario I have in mind is one which I personally have spent the past few weeks tearing my hair out over, namely passing arguments with embedded quotes. Shells like Bash and PowerShell support more than one style of quotes (for string interpolation reasons) which makes the simple case undaunting. The show should require something more akin to my recent task which involved passing a non-trivial PowerShell command line to a remote Windows VM from a Bash shell, which in turn invoked a shell script that used SSH to talk to the VM’s host and SSH from the host into the guest VM, which in turn had Bash configured as the default shell on the Windows side. That should keep them busy for a while just googling how to escape quote characters in different shells and tools!

The second game I have in mind taps into the Squid Game theme, but only in name – Stuck in the Mud. On this occasion we’re not alluding to the Multi-User Dungeon, which is probably more befitting of the Adventure Game, but the term popularised by Brian Foote and Joseph Yoder. As a system grows over time, close attention must be paid to the architecture and design lest it wind up as the aforementioned Big Ball of Mud [Wikpedia-2] – “a haphazardly structured, sprawling, sloppy, duct-tape-and-baling-wire, spaghetti-code jungle”. Hence the task our competitors must face would be to make sense of a legacy codebase and refactor it so the unnecessary duplication is removed and it becomes more amenable to change without taking its toll on the team’s morale.

Much as I like the play on words in that title, I think there is a better playground game that lends itself more to this particular exercise. In ‘Spot’, players take it in turns to kick a football against a wall, and if they miss, they lose a life. (Each life is represented by one letter of S.P.O.T. and when all lives are lost the player is out). Not only does the title gel nicely with the idea of refactoring to reduce the duplication of concepts, i.e. a Single Point of Truth (aka SPOT), but the format also suggests the use of limiting the number of test failures allowed as a mechanism for ‘lives’. I’m sure the ridiculousness of a scenario where the production code is in an absolute mess but also contains a full suite of tests won’t be lost on the contestants. I’m going to have my work cut out for me trying to provide a plausible backstory. (As an aside I’m now beginning to wonder if Kent Beck took his inspiration for “Test && Commit || Revert” from the show as that also seems quite brutal…)

Given the amount of exposure the TV show has had in the media and on the socials in the last few weeks, I don’t think it’s a spoiler to say that one of the challenges they face in Squid Game is a variation of what we Brits called Statues, but they call Red Light/Green Light, where the players have to creep up on the person who’s ‘it’ while their back is turned. I sense there is some additional testing related mileage here under the more ‘punful’ name Red Bar/Green Bar. Here you can’t make progress by adding new features to the product unless the bar is green; when it’s red you must fix the code first. That feels a little too much like real life but, in my game, you won’t be able to just comment the test out, add an ignore attribute, or make the test run multiple times in the hope it succeeds eventually and manages to hide the lack of determinism.

For the finale I can think of no more difficult a topic for programmers to tackle than that of time. In ‘What’s the Time, Mr. Wolf?’ our contestants will be faced with a series of challenges that require them to correctly calculate dates and times across the globe. For example, one task might be to use Outlook in one country to book a Zoom meeting where all the participants are situated in other countries. You lose a life if at least one person doesn’t show up at the correct time. Another would see you execute a multi-currency, multi-month trade where the start and end dates straddle Christmas and Golden Week, during a leap year. I mustn’t forget to include a daylight saving time puzzle in there somewhere too!

I’m sure if I cast my mind back far enough to my childhood, I can dredge up some more inspiration. The game of Sardines (a variant of Hide-and-Seek) where you work ever harder to overcome a lack of capacity has an eerily familiar tone to it. Likewise the practice of chaos engineering feels like it has its roots in a game of Knock Down Ginger where you try and switch off random hardware without getting caught by the customer, and I’ve definitely been involved in code reviews that have felt more like a game of British Bulldog!

References

[Wikipedia-1] List of children’s games: https://en.wikipedia.org/wiki/List_of_children%27s_games

[Wikipedia-2] Big ball of mud: https://en.wikipedia.org/wiki/Big_ball_of_mud

Chris Oldwood is a freelance programmer who started out as a bedroom coder in the 80s writing assembler on 8-bit micros. These days it’s enterprise grade technology plush corporate offices the comfort of his breakfast bar. He has resumed commentating on the Godmanchester duck race but continues to be easily distracted by messages.






Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.