The Joy of Algorithms


I’ve come to realize that play has a critical role in developing new algorithms, or as I explored in the previous posts on modelling, problem solving in general. Early in this project, I would find sorting algorithms described rigidly in mathematical terms. What was hidden from me was the process by which these algorithms were developed.  Like any math problem, tweaking the knobs to see what results is an important part of problem solving, especially if the problem appears intractable at the beginning.

Programmers are increasingly finding ways to play not just with the end result of an algorithm, but with the implementation. Code provides another material for play.  As I touched on when exploring abstraction, Stanford has been holding code poetry slams for the past two years. The idea of using code to make creative expressions demonstrates the joy in pushing the limitations of languages intended for a specific use. As with many materials, the users quickly find ways to subvert the intended use and use it on other creative ways. Some code poetry is simply meant to be read, yet it still must compile, and in some cases, actually perform some task. Others, such as the ChucKu, add the additional restrictions of a haiku format, but require the poem to output a sound. These are ideal examples of how multiple modes (visual, audio, logical) can be used together when playing.

Another popular method of playing with code take place in hackathons or other events where competitors are often limited in time frame or memory space. Often held over a weekend of college campuses, these competitions simultaneously restrict what participants can do, while being liberating in the sense that it can be freeing to deal with these limitations from the start. In the JS1K code golfing competition, programmers try to implement an algorithm using the shortest amount of code. One recent example comes from Jani Ylikangas who created Highway at Night,  a minute long, algorithmically-generated landscape flythrough that runs in a browser and takes less than 1k of code. These competitions are a continuation of the demo scene, where groups would create breathtaking graphics using the small amount of space and limited processing of computer of the time. Demos are not just visual, as some groups would focus on auditory programs, much like the auditory algorithms I explored early on in this project.

Video and board game designers have used algorithms as inspiration to create both educational and entertaining experiences. Robot Turtles engages younger students in creating simple algorithms to move a turtle around obstacles to reach a goal, similar to the LOGO programming language and other board games that use algorithms to control that action such as RoboRally. Videogames also make use of algorithms, such as one of my favorites in college, Carnage Heart. In the game, robots would engage in combat, but users could not directly control them. Instead, before combat began, you could provide instructions to the robots to follow during the round, so it pitted algorithm vs algorithm. More recent games such as SpaceChem allows players to create algorithms using blocks to build molecules, while Hack ‘n’ Slash has players creating small Lua scripts to solve puzzles in a Zelda-like game world.

Play is an overlooked skill when creating algorithms. In my next post, I will explore an easy way to introduce elementary students to playing with algorithms to create works of art.

Leave a Reply

Your email address will not be published. Required fields are marked *