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