Extreme sorting function needed
Aaarrggghhhh I'm stuck
Please help me :(
I'm developing a program for Beach/volleyball tournament's.
Depending on the teams ranking score they will be sorted into groups.
Lets say that I want 5 groups, then the highest ranked team will be placed
as team 1 in group 1, the second highest ranked team will be team 1 in group 2.
Team ranked as nr 6 will be placed as team 2 in group 5, ranked 7 as team 2 in group 4
....
Se list below
Code:
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25
Now heres the trouble, the highest ranked team will allways play the fewest
amount of game's. So If I have less than 25 teams but more than
20 teams the list will look like this.
Code:
for teamcount 21 to 24
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
22 21
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
23 22 21
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
24 23 22 21
Now if a 25'th team enters my tournament then the list will look like the first one.
Of course I want to be able to specify how many groups I want in my tournament.
right now I use an array containing the teams but in "real life" I will collect them
from a database.
I have not been able to get my for-loop to "reverse" correctly
and keep the count correct.
If anyone think they can help me, I would be very thankful
If this isn't clear enough please let me know and I will try to explain further.
You are my friend for ever
:D:D:D:D
Thank you Thank you Thank you
It works perfectly. :cool:
This is just what I have been trying to do for a while now.
I will mention you in my app :)