Question

Basically I would like some help on how to implement my idea. Any direction would be appreciated. I'm not sure what languages I should be using, or if I need a MySQL database of some kind.

I want to make a tournament bracket. I've read several posts on here about brackets but I couldn't find a solution.

I want to present the user with two options, pulled from a pool of about 16 choices. The two options would be randomly selected from the pool. The user will then pick the "better" or "best" option out of the two choices presented to him. After that "matchup" the pool would then be reduced to the remaining choices in pool, which would be 14. Immediately after the matchup, the user would then be presented with another two options, and the process will then repeat itself until all of the options in the pool have been used. There are 8 matchups in the first round, and then the matchups will continue until a single winner is selected. Also note that this bracket is not determined by score, but purely based on the user input (which one of the two choices he likes better). The end result is a visual bracket of the sole winner, and the other losing options based on the user inputs. This would require storing the users input in a database I suppose.

Here is a viauallization of a classic tournament bracket with 16 options.

Anyway, I would like to know how to implement/code this. I am very comfortable with HTML/CSS and I know very little PHP. I have setup databases and stuff like that.

Thoughts?

Was it helpful?

Solution

You'll want a database. Start with a teams table, put in your 16 entries. Then, via PHP:

SELECT * 
FROM teams
ORDER BY RAND()
LIMIT 2

Now you'll have to present the two teams to the user, and using an html form subiit or maybe some AJAX allow them to choose the winner. Now, make another table, say round_one_winners, and insert the user's selection.

INSERT INTO round_one_winners
  (name)
VALUES
  ('team one')

Repeat x8. Then:

SELECT * 
FROM `round_one_winners`
ORDER BY RAND()
LIMIT 2

Repeat x4, using a round_two_winners table!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top