No infinite loopign in tests. only Operate_Minimal works

This commit is contained in:
MarcUs7i 2024-12-17 12:18:38 +01:00
parent 0de64d6a94
commit 6a5be417d8
2 changed files with 4 additions and 6 deletions

View file

@ -56,10 +56,8 @@ public sealed class Chain
_fire.BurnHigher();
// step 3
if (_firstPerson is { HasBucket: true })
{
_firstPerson.UseWell(_well, null);
}
var bucket = new Bucket(_bucketSize);
_firstPerson.UseWell(_well, bucket);
// step 4
var currentPerson = _firstPerson;
@ -88,7 +86,7 @@ public sealed class Chain
}
// Step 5
if (lastPerson != null && lastPerson.HasBucket)
if (lastPerson is { HasBucket: true })
{
lastPerson.FightFire(_fire);
}

View file

@ -101,7 +101,7 @@ public sealed class Person
return false;
}
if (RightNeighbor._forwardBucket == null && _forwardBucket != null)
if ((RightNeighbor._forwardBucket == null || RightNeighbor._forwardBucket.IsEmpty) && _forwardBucket != null)
{
RightNeighbor._forwardBucket = _forwardBucket;
_forwardBucket = null;