[fix:] semester delivery updated to perform better results
This commit is contained in:
21
crafter.cs
21
crafter.cs
@@ -244,7 +244,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 +255,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