I cannot get a non-recursive/non-iterative solution, for the time slot_court
assignation.
I suggest you use a loop based approach (over a recordset), if you are using
Jet.
To find the timeslot_court assignation, starts with the full list of plays
(numbered from 1 to n(n-1)/2, n= number of players. Then, loop over each
play, and find the minimum timeslot available, given the 2 players.
Example with 6 players, 1 to 6.
p1 and p2 represent the 2 involved players.
slot is the assigned time slot for the play.
playNumber p1 p2 slot
1 1 2 1
2 1 3 2
3 1 4 3
4 1 5 4
5 1 6 5
6 2 3 x
7 2 4 y
8 2 5 z
9 2 6 a
10 3 4 b
11 3 5 ...
At step 6, in the loop, we have to find x. Players 2 and 3 are in
competition
From the previous rows, (1 to 5), we know that player 2 is already involved
in slot 1
we know that player
3 is already involved in slot 2
so x=3, the minimum slot available
At step 7, we know player 2, from previous rows, is involved in slots 1 and
3
player 4 is involved in slot 3
so y=2, the minimum slot available
At step 8, we know slots 1, 2, and 3 are not available for player 2
we know slots 4 is not available for player 5
so z=5
At step 9, slots 1, 2, 3, and 5 are not available for player 2
slot 5 is not available for player 6
so a=4
and so on. Also, when a time slot is used 4 times, it cannot be used
anymore (you only have 4 courts).
That procedure is iterative, but you can built it ONE time, save it in a
table, and if the number of players is constant, 16, you just have to
replace the number by the real player names.
Hoping it may help,
Vanderghast, Access MVP