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