php - round robin tournament home away distribution -


i writing script creates tournament fixtures using round robin algorithm first team fixed. , works well.

problem when create fixtures have distribute home , away close possible hahaha... pattern h - home , - away. limit team cannot play 3 home(or away) matches in row.

what tried preserving how many home , away matches each team played , team lowest home or away number play should.

for example

team 1 (2 h , 1 a) vs team 2 (with 2 h , 2 a)

result :

team 2(h) vs team 1(a) // because team 1 played least number away of games  

question: there other way implement such home away distribution, , if idea behind it?

the equal distribution pattern seek not readily available. suggestion 'random shuffle' not solve problem. distributing teams equally opponents, equally home & visitor, , equally play in time/location slots can done. there different requirements must met number of teams , odd number of teams. add math create each schedule totally different (for example 7 team league schedule different 8 team league).

checkout information provided on this link "equal distribution".

equal distribution of; teams, time slots, & home & visitor possible if have correct number of time slots available number of teams scheduling. understanding structure of schedules important. question above equal home & away (h & a) answered in link above. best can no more 2 h or 2 games in row in each round robin. there minor exception team have 3 home or 3 away games in row when round robin ending , starting next round robin. happens few teams, unavoidable, h & balanced @ end of each 2 round robins.

when scheduling teams round robin play, in simplest of terms looking create round robin of teams, round robin of home & visitor status, , round robin of time/location slots... @ same time.

to further complicate subject takes different number of round robins (one) satisfy equal 'team' distribution, different number of round robins (two) satisfy 'home & visitor' balance, , different number of round robins satisfy 'time slot' balance. number of round robins needed balance teams playing equally in time slots, number of teams, equal half number of teams being scheduled. changes when scheduling odd number of teams.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -