- Updated `ai.md` to clarify the mechanics of hunger restoration and the importance of lunch breaks in the school schedule. - Revised `schedule.md` to detail the new lunch break structure, allowing for separate sittings for different grade levels. - Enhanced `Decision.cs` and `DecisionPlanner.cs` to incorporate logic for lunch breaks, ensuring that students only leave lessons during their designated lunch windows. - Updated `DayFrameDef` and related classes to support multiple lunch breaks and validate their configurations. - Adjusted tests to validate the new decision-making logic regarding lunch breaks and hunger management, ensuring robust functionality. - Improved localization strings to reflect changes in the school day structure and lunch functionalities.
58 lines
1.8 KiB
C#
58 lines
1.8 KiB
C#
namespace HSchool.Content;
|
|
|
|
/// <summary>Bells and breaks of one school day. A catalog may have only one concrete frame.</summary>
|
|
public sealed class DayFrameDef : Def
|
|
{
|
|
/// <summary>Local game-clock time of the first lesson, <c>HH:mm</c>.</summary>
|
|
public string FirstLesson { get; init; } = "08:30";
|
|
|
|
public int LessonCount { get; init; }
|
|
|
|
public int LessonMinutes { get; init; }
|
|
|
|
public int BreakMinutes { get; init; }
|
|
|
|
/// <summary>The long break follows this 1-based lesson. Zero means every break is short.</summary>
|
|
public int LongBreakAfter { get; init; }
|
|
|
|
public int LongBreakMinutes { get; init; }
|
|
|
|
/// <summary>
|
|
/// Which break each parallel eats at. Empty means one sitting for the whole school, at
|
|
/// <see cref="LongBreakAfter"/>. Every listed break is a long one, so a school that feeds its
|
|
/// juniors and seniors separately gets two wide breaks rather than one crowded canteen.
|
|
/// </summary>
|
|
public IReadOnlyList<LunchBreakDef> LunchBreaks { get; init; } = [];
|
|
}
|
|
|
|
/// <summary>One lunch sitting: the break it happens at and the parallels it feeds.</summary>
|
|
public sealed class LunchBreakDef
|
|
{
|
|
/// <summary>The sitting fills the break after this 1-based lesson.</summary>
|
|
public int AfterLesson { get; init; }
|
|
|
|
public int GradeMin { get; init; }
|
|
|
|
public int GradeMax { get; init; }
|
|
|
|
public bool Covers(int year) => year >= GradeMin && year <= GradeMax;
|
|
}
|
|
|
|
public sealed class MonthDay
|
|
{
|
|
public int Month { get; init; }
|
|
|
|
public int Day { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// A holiday range in month-day, repeating every academic year. When start is after end
|
|
/// (winter), the range wraps across 1 January.
|
|
/// </summary>
|
|
public sealed class HolidayDef : Def
|
|
{
|
|
public MonthDay Start { get; init; } = new();
|
|
|
|
public MonthDay End { get; init; } = new();
|
|
}
|