Jump to content

Tournament Bracket and Pairing


uramagget

Recommended Posts

Hi, I'm trying to set-up a tournament, though I want the system to be automated. I'm not sure how to approach this, since I thought the process would be confusing. I want to setup random pairing, but how can that be done and then stored in a row? Plus, I'm not sure how I would display the pairings correctly for [x] round. Can anybody help out this confused user?

 

 

My basic layout for a bracket is: *removed by request of op*

 

If that is required to help out..

Link to comment
Share on other sites

So you have a database, correct?  You need to have a script that randomly pairs people, but only runs after a tournament finishes so you don't screw it up by accident by running it again, and then have a table that keeps track of wins and losses.

Link to comment
Share on other sites

assuming you have a database and have info in a table:

(untested, not on my computer)

// select all players, ordering list randomly
$sql = "select players from table order by rand()";
$result = mysql_query($sql);
// loop to get data from result source
while ($r = mysql_fetch_assoc($result)) {
   $list[] = $r['players'];
} 
// make a 2d array each pos has 2 players in it (last pos will have 1 player if there's 
// odd number of players
$pairs = array_chunk($list, 2);

// formatting the results is really up to you...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.