May 3, 200520 yr I have 10 teams, I'm trying to write a script that will make a 9 week schedule such that every team plays each other once. Sounds like such and easy thing to write I can easily populate all the fields, but making each match unique has got my brain all twisted. Anyone got any suggestions ?? thanks Ed
May 3, 200520 yr Making each match unique should be a combination of the two teams, maybe ID#'s or the Team Names if they are unique. At the first team set a Unique Field to ID_Team & "-", then when you get to the team they are playing use Set Field to add the second team, ie. Unique Field = Unique Field & ID_Team.
May 3, 200520 yr Hi Ed, It seems to me this would be best to use a script to populate related scheduled matchup records based on these rules: 1. A team should not get scheduled to play itself 2. A team should not play another team more than once We can use nested loops to generate records in a join table for each combination of teams, so long as the creation won't violate those two rules. Rule 2 brings us to a complication about the direction of the relationships used for the matchup. Using a join table we can add matchup records indicating that one team is scheduled to play another, but this join record will only indicate the scheduled matchup from one team's perspective, not both. We could create two join records for the scheduled matchup, one for each team's perspective, or we could try what I've done in the attached sample and use one join record, but viewed from two perspectives: Home matchups and Away matchups. Check out the attachment and let me know if it still doesn't make sense. Matchups.fp7.zip
May 4, 200520 yr This not easy at all - in fact it is quite complex. In addition to the match-ups, there needs to be a schedule. Not only cannot a team play against itself, it also cannot play twice in the same round of games. I have tried a calculated approach which seems to work, though I haven't really tested it against varying circumstances, e.g. number of teams. tournament.fp7.zip
May 4, 200520 yr Oh yea, forgot about the weeks thing. Back to the drawing board for my scripted approach.
May 4, 200520 yr If you want to find out about algorithms for round robin tournaments, check this link: http://www.devenezia.com/downloads/round-robin/index.html
May 4, 200520 yr It's back to the drawing board for me as well - my calculations are wrong! I can calculate either the correct match-ups, or the correct order of games - but not yet both at the same time...
May 4, 200520 yr Thanks for the link - I had a problem with his cycling in the "wrong" direction, but it helped. I hope this is it. tournament.fp7.zip
May 6, 200520 yr Author Thanks guys, for all the imput, all great ideas. I have written down a solution using C, i just need to translate it into filemaker scripting. If i get it working properly, i will post it. Thanks again.
May 6, 200520 yr Ah .. ?? .. I thought I had finished this? Have you not seen my last attachment, or did you find a problem with it?
Create an account or sign in to comment