Centralize simulation balancing values

This commit is contained in:
2026-05-08 21:38:03 +02:00
parent 8ec3c7847c
commit 8018ebbabb
13 changed files with 178 additions and 106 deletions

View File

@@ -4,13 +4,13 @@ public sealed class PipeBurstHazard : Hazard
{
public override IEnumerable<Forecast> Predict(LevelState level, int turns)
{
for (var y = 0; y < level.Height; y++)
for (var y = Balancing.FirstGridCoordinate; y < level.Height; y++)
{
for (var x = 0; x < level.Width; x++)
for (var x = Balancing.FirstGridCoordinate; x < level.Width; x++)
{
var position = new GridPosition(x, y);
var cell = level.GetCell(position);
if (cell is { HasPipe: true, PipeOpen: false, Flow: 0, LeakRate: >= 3 })
if (cell is { HasPipe: true, PipeOpen: false } && cell.Flow == Balancing.BrokenPipeFlow && cell.LeakRate >= Balancing.BurstLeakRate)
yield return new(EFailureKind.PipeBurst, position, turns, $"PIPE BURST PREDICTED AT {x},{y} IN {turns} TURNS");
}
}