This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Need help with algorithm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help with algorithm" Watch "Need help with algorithm" New topic

Need help with algorithm

Brett Williams

Joined: Aug 23, 2005
Posts: 19
OK, starting to actually put my project together and have been trying to figure out how I am going to accomplish the following:

I have a tournament with 4 different divisions. Each of these divisions is made up of a varying number of teams (from 3 to 7 teams per division). Each team needs to race the other in a "Round Robin" format. I want to generate a scheduled list of all the races to ensure that each team races every other team in their division ONLY.

Secondly, each team belongs to a club. A club may have more than one team in the same division and they may have teams in multiple divisions. I want to limit, as much as possible, teams from the same club running in consecutive races.

Lastly, the race takes place in two lanes, the left and the right. I need to ensure that teams get an "even" amount of racing in each lane. Preferably they would switch from left to right with each race, but that may not always be possible.

So, how impossible is this? Can anyone point me in the right direction?

Brett M. Williams<br />Co-Founder - United Flyball League International<br />Website Administrator<br />Software Developer<br />Database Admin<br />Anything else "techie"
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
this might do you for the round robin part

Brett Williams

Joined: Aug 23, 2005
Posts: 19
Thank you, it is definitely a start and easy enough to understand. I shouldn't have to tweak this much. I am assuming I would call this for each of the divisions and it would create the schedule for that division. This would leave me at having to marry all of the divisions schedules together into on list and then ordering the list, based upon my above requirements.

Thank you very much for helping with this.
I agree. Here's the link:
subject: Need help with algorithm
It's not a secret anymore!