Welcome Guest, Not a member yet? Register   Sign In
Tournament System - psuedo code
#1

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




Theme © iAndrew 2016 - Forum software by © MyBB