I made it so that the algorithm remembers what it has seen. Stores them as sets of names of players. This happens in the randomTeam() function.