I have a unique list of match-ups, player vs player. Here are the match-ups I need to allocate:
Kris -vs- Matt
Miki -vs- Stefon
Eric -vs- Sasha
Adam -vs- Kris
Brian -vs- Mike
Alex -vs- Dom
Dom -vs- Matt
Sasha -vs- Stefon
Eric -vs- Joey
Joey -vs- Kris
Alex -vs- Matt
Adam -vs- Dom
Brian -vs- Miki
Eric -vs- Stefon
Mike -vs- Sasha
Brian -vs- Stefon
Alex -vs- Brian
Alex -vs- Miki
Joey -vs- Mike
Kris -vs- Sasha
Brian -vs- Sasha
Matt -vs- Stefon
Joey -vs- Matt
Kris -vs- Miki
Brian -vs- Kris
Eric -vs- Mike
Dom -vs- Joey
Matt -vs- Sasha
Adam -vs- Stefon
Dom -vs- Mike
Eric -vs- Miki
Adam -vs- Joey
Alex -vs- Mike
Adam -vs- Eric
Dom -vs- Miki
Adam -vs- Alex
There are a total of 12 unique players above. Each player plays 6 match-ups. Each match-up above needs to be allocated to a week (segment) below. There are six match-ups per week and six weeks in total.
Weeks:
Week 1
Week 2
Week 3
Week 4
Week 5
Week 6
To prevent confusion, I should note, that there are more possible combinations with 12 players, but that these specific ones are the match-ups I need to allocate
Here is what a week would look like (example):
Week 1:
Kris -vs- Matt
Miki -vs- Stefon
Eric -vs- Sasha
Adam -vs- Joey
Brian -vs- Mike
Alex -vs- Dom
- Each match-up in the example is found in the array of match-ups (above)
- Each of the 12 players plays a match in the above example
I am hoping to solve this problem with PHP. I am not clear on how to tackle this. My general thinking was to run a loop, where it places each match-up into a week and then validates. If validation is not met, it would run the next loop, incrementing by 1, until it reaches the correct combination where all 12 players play each week.
Let me know if you have a solution for this problem. Thanks!