Enhance AI and simulation components with presence management and routing capabilities
- Introduced the `HSchool.Ai` project, responsible for routing, day plans, and presence management. - Updated the `HSchool.Simulation` project to integrate with the new AI functionalities, improving decision-making and presence tracking. - Added `travelMinutes` to room and territory definitions, ensuring accurate movement calculations within the simulation. - Enhanced the `School` class to manage presence and implement empty-time skipping functionality. - Updated documentation to reflect the new AI features and their impact on school simulation. - Added tests for presence management and routing to ensure robust functionality and reliability.
This commit is contained in:
@@ -4,7 +4,7 @@ namespace HSchool.People;
|
||||
/// Per-family streams derived from the school seed. Family N never consumes family N-1's rolls,
|
||||
/// so appending a thirteenth family leaves the first twelve unchanged.
|
||||
/// </summary>
|
||||
internal static class Seed
|
||||
public static class Seed
|
||||
{
|
||||
public const int ChildCountSalt = 1;
|
||||
public const int AppearanceSalt = 2;
|
||||
@@ -12,6 +12,7 @@ internal static class Seed
|
||||
public const int SeatShuffleSalt = 4;
|
||||
public const int HouseholdSalt = 5;
|
||||
public const int ApplicantSalt = 6;
|
||||
public const int CommuteSalt = 7;
|
||||
|
||||
/// <summary>A stream that belongs to the school rather than to one family.</summary>
|
||||
public static int ForSchool(int schoolSeed, int salt) => Mix(schoolSeed, familyIndex: -1, salt);
|
||||
@@ -24,6 +25,28 @@ internal static class Seed
|
||||
return (int)z;
|
||||
}
|
||||
|
||||
/// <summary>A stream that belongs to one person on one calendar day — commute slack, not looks.</summary>
|
||||
public static int Mix(int schoolSeed, string personId, int dayNumber, int salt)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(personId);
|
||||
var z = Mix64((uint)schoolSeed);
|
||||
z = Mix64(z ^ Stable(personId));
|
||||
z = Mix64(z ^ (uint)(dayNumber + 1));
|
||||
z = Mix64(z ^ (uint)(salt + 1));
|
||||
return (int)z;
|
||||
}
|
||||
|
||||
private static uint Stable(string value)
|
||||
{
|
||||
ulong z = 0;
|
||||
foreach (var character in value)
|
||||
{
|
||||
z = Mix64(z ^ character);
|
||||
}
|
||||
|
||||
return (uint)z;
|
||||
}
|
||||
|
||||
private static ulong Mix64(ulong z)
|
||||
{
|
||||
z += 0x9E3779B97F4A7C15UL;
|
||||
|
||||
Reference in New Issue
Block a user