Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2008
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Groups Distribution

    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
    Attached Thumbnails Attached Thumbnails Groups Distribution-groups.jpg  
    Last edited by john_zakaria; 06-22-2010 at 09:10 AM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    Regular Coder
    Join Date
    Dec 2008
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    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

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •