## Scheduling Algorithm

The "scheduleCamp()" function in class CCamp is divided into three main tasks:
• Schedule games in Carmichael
• Schedule games in Dean Dome
• Schedule all other games

### Scheduling Carmichael

The scheduleCamp() function runs through all of the leagues and creates the list of possible games (CGameNodes) for the league before calling this function. If the league is not a high school league, this function does nothing. If it is a high school league, it goes on to schedule each of the league's teams at least once and no more than twice in Carmichael. To do this, it starts at the head of the list of CGameNodes and runs through looking for a game in which neither of the teams have played in Carmichael. Any time it finds one, it puts those teams in the corresponding CNode and removes the CGameNode from the list. After it has gone through every CGameNode, it still needs to go back and make sure every team has played in Carmichael at least once. So, it starts at the first team in the league and if it has not played in Carmichael, it will look for a game with another team in the league which has played in Carmichael only once. After it has gone through every team, we know that every team plays in Carmichael at least once. This algorithm will not allow a team to be scheduled more than once per session.

### Scheduling Dean Dome

ScheduleCamp() calls this function twice for each league - once to make sure that each team is scheduled at least once, but no more than twice in the Dean Dome (its official name is the Smith Center, but is refered to as the "Dean Dome" throughout the algorithm), and a second time to schedule each team twice in the Dean Dome (no team can be scheduled more than three times in the Dean Dome by this algorithm). It works very similar to the algorithm which schedules Carmichael, running through the CGameNode list looking for games to schedule, and then running through the teams making sure they are scheduled - first once, then twice - in the Dean Dome. Like the Carmichael algorithm, it will not schedule any team more than once per session.

### Scheduling The Remaining Games

Neither of the previous algorithms will allow a team to be scheduled more than once in any session. However, this algorithm checks to make sure that each team has played in every session, and allows teams to be doubled up in a session when necessary. It is run once for each league, for each sessoin (so it is run (#of leagues) X (#of sessions) times). It goes through every team in the league and, if it hasn't played in the session, it does its best to schedule it for a game in that session. Howver, it will not violate any constraints to do so. If a time and court can not be found that do not violate any of the constraints, the team will be skipped and left unscheduled in this session. It will also not allow teams to be scheduled more than twice in any session. It gives priority for the bigger courts to the high school teams by starting at the high school leagues and working down to the JV and JH teams. High School teams will not be scheduled on small courts and JV and JH teams will not be scheduled in Carmichael.