Compare commits
2 Commits
ea280ea05d
...
42ecde799c
| Author | SHA1 | Date | |
|---|---|---|---|
| 42ecde799c | |||
| ce70d86fd3 |
38
crafter.cs
38
crafter.cs
@@ -193,25 +193,6 @@ public class CourseCrafter
|
|||||||
|
|
||||||
} while (changed && iteration < maxIterations);
|
} while (changed && iteration < maxIterations);
|
||||||
|
|
||||||
int getSemester()
|
|
||||||
{
|
|
||||||
//int sem = 0;
|
|
||||||
if (GeneratedCourses.Count == 0) return 1; // zunächst im ersten Semester beginnen
|
|
||||||
int[] semcount = new int[4] {0,0,0,0}; // Anzahl der generierten Kurse im jeweiligen Semester
|
|
||||||
foreach (var inst in GeneratedCourses)
|
|
||||||
{
|
|
||||||
semcount[inst.Semester - 1]++; // ...füllen
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i<semcount.Length; i++) // durchlaufen und prüfen
|
|
||||||
{
|
|
||||||
if (semcount[i] < Settings.Instance.NumCoursesPerSemester)
|
|
||||||
{
|
|
||||||
return i+1; // Semester zurückgeben, wenn genug da sind
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isStudentFree(int semester, string studentID)
|
bool isStudentFree(int semester, string studentID)
|
||||||
{
|
{
|
||||||
@@ -244,7 +225,7 @@ public class CourseCrafter
|
|||||||
|
|
||||||
if (low >= initial_sportlist.Count) return true;
|
if (low >= initial_sportlist.Count) return true;
|
||||||
|
|
||||||
if (globalCount >= 12) return true;
|
if (globalCount >= 20) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,26 +236,27 @@ public class CourseCrafter
|
|||||||
|
|
||||||
int getSemesterForSport(Sport sp)
|
int getSemesterForSport(Sport sp)
|
||||||
{
|
{
|
||||||
int[] semcount = new int[4] {0,0,0,0};
|
int[] semcount = new int[4];
|
||||||
|
|
||||||
foreach (var inst in GeneratedCourses)
|
foreach (var inst in GeneratedCourses)
|
||||||
{
|
|
||||||
semcount[inst.Semester - 1]++;
|
semcount[inst.Semester - 1]++;
|
||||||
}
|
|
||||||
|
int bestSem = 0;
|
||||||
|
int minCourses = int.MaxValue;
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
// 1. Ist der Sport in diesem Semester erlaubt?
|
|
||||||
if (sp.Semester[i] == 0) continue;
|
if (sp.Semester[i] == 0) continue;
|
||||||
|
|
||||||
// 2. Ist noch Platz für Kurse?
|
if (semcount[i] < Settings.Instance.NumCoursesPerSemester &&
|
||||||
if (semcount[i] < Settings.Instance.NumCoursesPerSemester)
|
semcount[i] < minCourses)
|
||||||
{
|
{
|
||||||
return i + 1;
|
minCourses = semcount[i];
|
||||||
|
bestSem = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return bestSem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user