Round Robin specific Tennis scheduler

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
belmanski
Forum Newbie
Posts: 1
Joined: Thu Jul 18, 2013 6:50 am

Round Robin specific Tennis scheduler

Post by belmanski »

Can anyone help advising on creating a round robin specific scheduler:

Round Robin Tennis Scheduler and Ranking

Playing rounds: 24
Playing courts: 2
Players: 12
Playing game: double (2:2)

Total matches: 24*2=48
Total playermatches: 48*4=192
PLaying times player: 192/12=16

Main goals:

equal balanced playing time
every match with different partner, after playing with everyone random play again with same player (12 player, means 11 different partners but we have 16 playing times)
every match against different opponent

Ranking:
every playing sets won: 2 points
won by more then 2 sets difference 1 point extra
counting games won
counting games lost
total matches
matches played
matches to play

Ranking order:
1. total points
2. matches to play
3. games won - games lost

Any help would be very appreciated.

Eric
User avatar
mecha_godzilla
Forum Contributor
Posts: 375
Joined: Wed Apr 14, 2010 4:45 pm
Location: UK

Re: Round Robin specific Tennis scheduler

Post by mecha_godzilla »

Hi,

One way to do this would be to store values for each player in an array and then use something like PHP's array_rand() function to select a random player from that array. If you then remove that player's entry in the array then your script won't pick that player again when your script needs to select their opponents. You might want to put this script logic in a while() loop that iterates through all the values in the array until there are none left.

I think you'd probably want to define a few different arrays just so that you can reset the list of players each time a new game needs to be scheduled. You can also use the in_array() function to check whether a value already exists in an array, so you could create a set of arrays that were initially empty but are then populated with players moved across from the other set of arrays.

Creating the match scheduler and recording/displaying the results are two separate tasks, so I would recommend getting the match scheduler logic working first so that you're not trying to solve two different problems at the same time.

HTH,

Mecha Godzilla
Post Reply