Will: a test seam lowers the Attention and Consciousness slots; tests pin every reader of Will
Attention and Consciousness get internal setters, Actor.SetWillSlots and an InternalsVisibleTo for Lodur.Core.Tests; nothing public changes and the slots still start at 1. Tests assert Will = min(resolve x attention, consciousness) and that reflex suppression, the flinch gate and the voluntary weight each move when a slot drops with resolve full. Each of six mutants (reflex, weight or gate reading Resolve; Will as Resolve, without Attention, without the Consciousness cap) fails the suite. Addresses finding will-slots-unpinned. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9c26a5509a
commit
f8f88f53c0
4 changed files with 113 additions and 5 deletions
|
|
@ -82,6 +82,13 @@ namespace Lodur
|
|||
/// <summary>A snapshot of the drive; nothing but <see cref="Tick"/> writes it.</summary>
|
||||
public DriveState Drive => _drive;
|
||||
|
||||
/// <summary>Sets the drive's Attention and Consciousness slots; a seam for the tests until lodur-startle-attention and lodur-physiology drive them.</summary>
|
||||
internal void SetWillSlots(double attention, double consciousness)
|
||||
{
|
||||
_drive.Attention = attention;
|
||||
_drive.Consciousness = consciousness;
|
||||
}
|
||||
|
||||
public Brain Brain => _brain;
|
||||
|
||||
/// <summary>The index in <see cref="Brain"/>'s goals of the goal in force; it changes only on the tick that reports <see cref="TickEvents.GoalChanged"/>.</summary>
|
||||
|
|
|
|||
|
|
@ -90,16 +90,16 @@ namespace Lodur
|
|||
/// <summary>How many times the will has broken.</summary>
|
||||
public int Breaks { get; private set; }
|
||||
|
||||
/// <summary>The fraction of resolve that attention lets through, 0..1. A slot: nothing lowers it yet (lodur-startle-attention fills it).</summary>
|
||||
public double Attention => 1.0;
|
||||
/// <summary>The fraction of resolve that attention lets through, 0..1. A slot, 1 until lodur-startle-attention fills it.</summary>
|
||||
public double Attention { get; internal set; }
|
||||
|
||||
/// <summary>The ceiling on the will that wakefulness sets, 0..1. A slot: nothing lowers it yet (lodur-physiology fills it).</summary>
|
||||
public double Consciousness => 1.0;
|
||||
/// <summary>The ceiling on the will that wakefulness sets, 0..1. A slot, 1 until lodur-physiology fills it.</summary>
|
||||
public double Consciousness { get; internal set; }
|
||||
|
||||
/// <summary>The will that is available to hold reflexes down and to power voluntary behaviour: resolve through attention, capped by consciousness.</summary>
|
||||
public double Will => Math.Min(Resolve * Attention, Consciousness);
|
||||
|
||||
internal static DriveState Fresh => new DriveState { Resolve = 1.0 };
|
||||
internal static DriveState Fresh => new DriveState { Resolve = 1.0, Attention = 1.0, Consciousness = 1.0 };
|
||||
|
||||
/// <summary>A goal's entry effect: sets resolve, then the mend check runs (a break the entry lifts past <see cref="DriveParameters.WillMendsAt"/> is mended). It is not a break and counts none.</summary>
|
||||
internal void Enter(DriveParameters p, double resolve)
|
||||
|
|
|
|||
|
|
@ -7,4 +7,9 @@
|
|||
<RootNamespace>Lodur</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- The tests lower the Attention and Consciousness slots, which nothing in the core does yet. -->
|
||||
<ItemGroup>
|
||||
<InternalsVisibleTo Include="Lodur.Core.Tests" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Reference in a new issue