• Curious: Why a set?

Question related to mission Berserk Rook


I'm having trouble on this problem because the enemy rook pieces are represented as a set. Since a set is an unordered collection when I try to match my rook against the enemy rooks to see if they share a rank or file the order keeps changing. I have changed the set to a list and things are going smoother. Am I missing something here?