Algorithm for "Swiss teams" (bridge) I am writing on software that has to create matches between teams of bridge players. Each round a new series of matches is calculated. The algorithm has to meet these two criteria:


Each round every teams must meet a team against which it has not played before.
The teams that play against each other should have as close a total score as possible.


This method is known as "Swiss teams". Can someone point me in the right direction?

Read some more about the Swiss-tournament system
Specifically this looks like the Stable Roommate Problem (SRP). Alternate the order of preference based on position in a list sorted by distance from the total score. I.E., imagine a list with the following scores:  

1, 3, 18, 19, 20, 21.  

Then the preference list would be:  

1: 3, 18, 19, 20, 21
3: 1, 18, 19, 20, 21
18: 19, 20, 21, 3, 1
19: 18, 20, 21, 3, 1
20: 19, 21, 18, 3, 1
21: 20, 19, 18, 3, 1

For more accuracy use the Stable Roommate With Ties (SRT) algorithm.

The way Swiss Teams differs from SRP is that not everyone will be listed. That is, if the teams with scores 20 and 18 have played each other already then neither list each other as preferences. It's possible that SRP will still give the correct result but it remains to be verified.