A hauler loads up to twice what the door took on its last fresh visit
Self: a carrier that brings only what was taken last time can never find a door that has grown hungrier. LoadLimit is ProbeFactor (2) times the units taken (at least one when any was), capped as before by the hold and by what From holds; a fresh outright refusal still caps it at zero and a good with no fresh sight loads whole. ALoadFollowsWhatTheDoorTook pins six for three taken. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
14e9e11ecd
commit
051020dc5b
2 changed files with 10 additions and 6 deletions
|
|
@ -43,13 +43,16 @@ public static class HaulRun
|
|||
return refused;
|
||||
}
|
||||
|
||||
// How many units of the good the hauler loads: what To took of it on its last visit while that sight is fresh, none of a good it saw
|
||||
// refused outright, and the whole hold of a good it has no fresh sight of (it learns by trying).
|
||||
// How many units of the good the hauler loads: up to ProbeFactor times what To took of it on its last visit while that sight is fresh (a
|
||||
// carrier that brings only what was taken last time never finds a door that has grown hungrier), none of a good it saw refused
|
||||
// outright, and the whole hold of a good it has no fresh sight of (it learns by trying). The hold and what From has cap it further.
|
||||
public const int ProbeFactor = 2;
|
||||
|
||||
private static int LoadLimit(Ship ship, CultRecordKey good)
|
||||
{
|
||||
var sight = ship.HaulSeen?.Sights.FirstOrDefault(candidate => candidate.Good.Key.Equals(good));
|
||||
if (sight == null || !Fresh(ship, sight)) return int.MaxValue;
|
||||
return sight.Took > 0 ? sight.Took : sight.Left > 0 ? 0 : int.MaxValue;
|
||||
return sight.Took > 0 ? Math.Max(1, ProbeFactor * sight.Took) : sight.Left > 0 ? 0 : int.MaxValue;
|
||||
}
|
||||
|
||||
// The units of the good the hold may still take at From: its load limit less what it carries.
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ public sealed partial class RunStartTests
|
|||
}
|
||||
|
||||
// A hauler loads toward what the door took on its last visit, not a whole hold: with a fresh sight of 3 units taken, a call at a From that
|
||||
// holds twenty loads three; with no sight it loads what the hold takes.
|
||||
// holds twenty loads six, twice what was taken (it probes upward).
|
||||
[Fact]
|
||||
public void ALoadFollowsWhatTheDoorTook()
|
||||
{
|
||||
|
|
@ -196,8 +196,9 @@ public sealed partial class RunStartTests
|
|||
Stock(leg.From, leg.Good, 20);
|
||||
leg.Hauler.HaulSeen = new HaulSeen { Sights = { new HaulSight { Good = new CultRecordRef<ItemData>(leg.Good), At = leg.FromZone.Contents.ExactTime, Took = 3 } } };
|
||||
Assert.True(HaulRun.Call(leg.Hauler, leg.From));
|
||||
Assert.Equal(3, Held(new[] { leg.Hauler }, leg.Good));
|
||||
Assert.False(HaulRun.CanCall(leg.Hauler, leg.From, leg.Order) && Held(new[] { leg.Hauler }, leg.Good) >= 3 && HaulRun.Leg(leg.Hauler, leg.Order).Equals(leg.From.OrbitData));
|
||||
Assert.Equal(6, Held(new[] { leg.Hauler }, leg.Good));
|
||||
Assert.Equal(2, HaulRun.ProbeFactor);
|
||||
Assert.False(HaulRun.CanCall(leg.Hauler, leg.From, leg.Order) && Held(new[] { leg.Hauler }, leg.Good) >= 6 && HaulRun.Leg(leg.Hauler, leg.Order).Equals(leg.From.OrbitData));
|
||||
}
|
||||
|
||||
// No ping-pong: over 24 sim h on seed 2 a hauler never turns straight back through the wormhole it came by without a call between (the
|
||||
|
|
|
|||
Loading…
Reference in a new issue