...

View Full Version : Groups Distribution



john_zakaria
06-22-2010, 08:29 AM
i want to make group distribution like the world cup 2010 for a tournament but according to the following criteria:

1- i have a classification for teams from 1 to n (n is the number of teams per groups)

2- number of groups = i

i want to distribute the teams to the groups randomly in php according to team classification

i.e: classification 1 will be the head of the groups.
so each group will contains random team according to the classification so that no teams will be with same classification at same groups

i want to make it dynamically so that the administrator will enter number of groups and number of teams and number of team per group will be number of teams / number of groups

i want to distribute the teams in groups according to its classification
please reply as soon as possible

Fou-Lu
06-22-2010, 03:44 PM
Just like the reply I left to your other user account, what is your actual question here?
Are you looking for a paid request, or help in a specific issue?

john_zakaria
06-23-2010, 07:17 AM
Just like the reply I left to your other user account, what is your actual question here?
Are you looking for a paid request, or help in a specific issue?

i want only an idea to make this task coz i dont know how to make it... i want idea only

Fou-Lu
06-23-2010, 03:22 PM
I'm afraid I have no idea what your talking about with classifications, teams, and groups.
It sounds like you'll need a master list of some sorts that you will pick items out of - potentially randomly - and assign to another list. If this is the case, you simply shuffle your master list, use array_pop or array_shift to remove items from the list, and assign it randomly using the rand() function to another list. You do this while space is available in lists, deny additions when in excess and force a new random roll.
Alternatively for a little more optimization, you can queue your secondary lists, add from the master list to the first in the queue, enqueue this list again, and continue this process until all queued lists are full. Remove the lists from the queue when full to prevent attempts to write into a full list.
These can be done with just an array, or you can look at using the new splQueue datastructure.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum