CodeIgniter Forums
Tournament System - psuedo code - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Tournament System - psuedo code (/showthread.php?tid=4998)



Tournament System - psuedo code - El Forum - 12-30-2007

[eluser]Kemik[/eluser]
Hello all,

I'm building a tournament system and I'm going through the planning stages, specifically making the psuedo code.

I'm trying to think how I would take a list of players, add a number of passes if there are spaces left (total spaces - number of users signed up) and then randomise who each user plays against.

The system is using user_ids to identify users.

So, on click of "Make fixtures" the following occurs:

1. Get $maxusers and $nosignedup.
2. $passes = $nosignedup - $maxusers.
3. Get array of users ($users [user_id])
4. A loop to add a user with the user_id of -1 for each pass to $users array.

Here's where I'm stuck. I need to randomise the user_id in the array and then some how make fixtures for the tournament. E.g. if the tournament has max users of 8 it will make 4 fixtures.

Any ideas would be appreciated.