A solution to CodeCombat.com's programming challenge: Gridmancer