Refactor the functions 'gs.attacked?' and 'gs.transitable?' so that
iterating functions are used instead of 'for' loops.