Helper functions and code for FightCodeGame