mardi 18 décembre 2018

Shuffling list of competitors, each month different competitor

for my friends sportscompetition, each player has to play 1 game a month against an other player. Now if i have a list of 20 players or so its not that hard to randomize the first month so i have 10 matches.

All the months after that though i'm not sure how to get the randomizer working so they won't be matched against a player they have played against.

Right now i made an sql database with Players(Name, (int)Id, Email) , Matches(Id, Player1ID, Player2ID)

I'm thinking for a randomize of the list and checking if each match doesn't contain 2 id's from a match in the database. And if 1 match does, redo the entire randomize of that month.

But i'm not sure if thats the best way




Aucun commentaire:

Enregistrer un commentaire