Percepts: Touch updates the slot's Kind; a freed slot is zeroed fully; tests for both and for the anonymous-emitter hole
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ee23c32898
commit
4118b4792d
2 changed files with 35 additions and 0 deletions
|
|
@ -388,6 +388,10 @@ namespace Lodur
|
|||
if (_pId[s] != 0 && !_pSensed[s] && _pSince[s] > _memorySeconds)
|
||||
{
|
||||
_pId[s] = 0;
|
||||
_pKind[s] = 0;
|
||||
_pX[s] = 0f; _pY[s] = 0f; _pZ[s] = 0f;
|
||||
_pSalience[s] = 0.0;
|
||||
_pSince[s] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -484,6 +488,7 @@ namespace Lodur
|
|||
_pSalience[slot] = salience;
|
||||
}
|
||||
|
||||
_pKind[slot] = e.Kind;
|
||||
_pSensed[slot] = true;
|
||||
_pSince[slot] = 0.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,36 @@ public sealed class PerceptTests
|
|||
return n;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_remembered_id_sensed_with_a_new_kind_takes_the_new_kind()
|
||||
{
|
||||
var p = Make();
|
||||
Sense(p, new[] { At(1, kind: 7) });
|
||||
Sense(p, new[] { At(1, kind: 9) });
|
||||
Assert.Equal(9u, p.Percept(SlotOf(p, 1)).Kind);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_free_slot_is_all_zero_after_forgetting_and_an_anonymous_emitter_cannot_write_into_it()
|
||||
{
|
||||
var p = Make(capacity: 2, memory: 0.05);
|
||||
Sense(p, new[] { At(1, x: 0.5f) });
|
||||
for (var i = 0; i < 20; i++) Sense(p, Array.Empty<Emitter>());
|
||||
Assert.Equal(0, Occupied(p));
|
||||
for (var i = 0; i < 3; i++) Sense(p, new[] { At(0, x: 0.5f) });
|
||||
for (var s = 0; s < p.PerceptCount; s++)
|
||||
{
|
||||
var c = p.Percept(s);
|
||||
Assert.Equal(0UL, c.Id);
|
||||
Assert.Equal(0u, c.Kind);
|
||||
Assert.Equal(0f, c.X);
|
||||
Assert.Equal(0f, c.Y);
|
||||
Assert.Equal(0f, c.Z);
|
||||
Assert.Equal(0.0, c.Salience);
|
||||
Assert.Equal(0.0, c.SecondsSinceSensed);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_anonymous_emitter_loads_the_nerve_and_makes_no_percept()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue