Hi I am a volunteer youth coach trying to create a function that
will automatically create a team vs team schedule, any odd number
team would get a bye if needed.
function Schedule($NumberOfGames, $NumberOfTeams) {
// I have been trying a while to get this, nothing works correctly
// I don't understand how push can help do this?.
echo $schedule;
}
There isn't anywhere near enough information here. What are the rules for selection of games? I assume that its always one team versus another team, but what rules drive whom plays whom? Does a schedule adjust based on wins and losses?
There isn't anywhere near enough information here. What are the rules for selection of games? I assume that its always one team versus another team, but what rules drive whom plays whom? Does a schedule adjust based on wins and losses?
Hi, No all teams play against each other the same amount of times over a 10 game
schedule, that's why I am having a hard time with it. I need to use functions I never used
before like pop push etc
what I want to do in theory is really simple, but the coding seems really hard
at least for me.
in the example below for simplicity sake
8 teams play each other over a 10 game schedule that's it, should I have a odd team
they would simply get a bye for that week that's about it.
I would need an array to feed the teams but am not sure what type would be best
because I don't know what built in php functions to use that might accomplish this.
$TeamNames = "team1","team2","team3","team4,"team5","team6,"team7","team8";
the function result should be something like
team1 vs Team9
team5 vs team7
team 2 vs team6
team3 vs team4
Week 1 example and so on for week two
in summery I want to create a simple 10 week schedule ( That's 1 game a week)
where 8 teams play against each other the same amount of times. if I have a odd
number of teams provide a bye if needed.
So you need a combination based on team count x? That won't equate to 10; if you have 8 teams playing that would equate to. . . 28. Wait is that right?
(8!/(8-2)!)*1/(2!) = 40320/720 * 0.5 = 56 * 0.5 or 28. Yeah, so at 8 teams in order to play ever other team you would require 28 weeks, not 10. To get the 10, you would need exactly 5 teams, so you'd have these combinations:
I said in my post above if there is a odd number team just give it a bye?
but I'm not even talking about that since I have 8 teams in my example?
I can't explain things any better or clearer then I have.
its really simple in theory, I don't get what your saying its not that complex
or confusing.
I have 8 teams in the league, each team plays a total of 10 games,
(that's equivalent to a 10 week schedule)
I'm just looking to create a simple basic schedule where they play against each
other that's all there is to it, nothing else to compute or think off.
I have been at this on and off for over 2 months now, that's why I tried to get
help here. when someone explains how to do this I will most likely slap myself in
the head as always,
Thanks man, I will try that ASAP, that appears to be exactly what I need to do
guess I will pass the team names to schedule with a array. do you know the best
way to do this within the function?
This has repetition in it. I'm under the impression repetition is not desired, so 1 should play 2 only once. That's easy to accommodate though.
Perhaps I'm still not "getting it" here. I still see that if you had 8 teams it would equate to 28 games played, not 10 (9 teams would be 36, 10 would be 45, etc). I'm not sure how you intend to shove the 8 teams into a 10 week period.
This has repetition in it. I'm under the impression repetition is not desired, so 1 should play 2 only once. That's easy to accommodate though.
Perhaps I'm still not "getting it" here. I still see that if you had 8 teams it would equate to 28 games played, not 10 (9 teams would be 36, 10 would be 45, etc). I'm not sure how you intend to shove the 8 teams into a 10 week period.
Fou, 8 teams are playing a game against each other, every Sunday for 10 weeks
yes eventually they will be playing against each 5 times over 40 games.
every team will play 10 games, there will be 4 games played every Sunday
for a total of 40 games overall.
Wait step back a step here.
Assuming we have 8 teams in total yes? So we have each team playing 10 games; where do the extra 3 games per team come from (shared over multiple teams of course, so that's. . . 1.5 average I guess)? With only 8 teams in total to play, each team would only require a total of 7 games to play against (hence the 28 total game play for the number of combinations).
Is it just round robin on it? Lets only focus on team 1.
The part that has me baffled as to how to deal with it is the remaining days beyond the permutation count for the number of teams. So with the above, we cap out on the 7th day, so I don't know how to make up the additional three days.
So the best way I can describe my conundrum here: I can easily calculate and generate the 28 required permutations. But I can't figure out how to match it to a ruleset of 4 per week for 10 weeks (which accounts for 40 games total) which is 12 above the original combination options (or 1.5x per team avg), some teams will need to play multiple other teams (up to 3x) repetition, but I don't know how to select which teams should be doing that.
Wait step back a step here.
Assuming we have 8 teams in total yes? So we have each team playing 10 games; where do the extra 3 games per team come from (shared over multiple teams of course, so that's. . . 1.5 average I guess)? With only 8 teams in total to play, each team would only require a total of 7 games to play against (hence the 28 total game play for the number of combinations).
Is it just round robin on it? Lets only focus on team 1.
The part that has me baffled as to how to deal with it is the remaining days beyond the permutation count for the number of teams. So with the above, we cap out on the 7th day, so I don't know how to make up the additional three days.
So the best way I can describe my conundrum here: I can easily calculate and generate the 28 required permutations. But I can't figure out how to match it to a ruleset of 4 per week for 10 weeks (which accounts for 40 games total) which is 12 above the original combination options (or 1.5x per team avg), some teams will need to play multiple other teams (up to 3x) repetition, but I don't know how to select which teams should be doing that.
Hi Just trying to create a function where I enter the number of teams, and the number of
games to play, and the function simply creates a schedule, again if I have a odd number of
teams, it gives a team the bye if needed. that's about it.
Yes, I'm aware of what you want to do. What I'm saying is with 8 teams you cannot play a total of 40 games without partial repetition. So my question is still how to deal with which combinations are chosen for repetition. So I can only write combinations which apply to 7 games per team; that is one team plays every other team once and only once (28 games). If you played 56 total games (repetition allowed), then you could do it evenly with the 8, but not with 40.
The only way to get to the 40 with 8 teams really is to make it so every team only plays a total of 5 games. But again, that creates a problem since you still need to decide which two teams each team will not play against (each team needs to play 7 in order to play completely against each other).