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
https://forums.phpfreaks.com/topic/110315-tournament-bracket-and-pairing/
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.

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...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.