Untested port of CodeCombat Cook code.