Solution to level 13 in Untrusted: http://alex.nisnevich.com/untrusted/