Стабилизировать переход через пилу уровня 5

This commit is contained in:
2026-08-18 17:33:54 +03:00
parent f06467fcfa
commit a8d72024f2
2 changed files with 43 additions and 5 deletions
@@ -118,6 +118,17 @@ public final class LevelPlaytestBotTest {
assertTrue(result.doorOpened());
}
@Test
public void levelFiveDelayedDecisionStillClearsTheSawWithOneVolunteer() {
LevelFiveDriver driver = new LevelFiveDriver(true);
LevelPlaytestBot.Result result = new LevelPlaytestBot().proveLevelFive(driver, 25_000L);
assertTrue(result.diagnostic(), result.completed());
assertEquals(1, result.deaths());
assertEquals(1, result.corpseCount());
}
@Test
public void automationSnapshotDefaultsToNoMovingPlatform() {
GameView.AutomationSnapshot snapshot = new GameView.AutomationSnapshot(
@@ -275,6 +286,7 @@ public final class LevelPlaytestBotTest {
}
private static final class LevelFiveDriver implements LevelPlaytestBot.Driver {
private final boolean overshootApproach;
private int startedLevel;
private long nowMillis;
private boolean moveRight;
@@ -285,6 +297,16 @@ public final class LevelPlaytestBotTest {
private int deaths;
private int corpses;
private float x = 130f;
private float y = 760f;
private boolean sawTakeoffObserved;
LevelFiveDriver() {
this(false);
}
LevelFiveDriver(boolean overshootApproach) {
this.overshootApproach = overshootApproach;
}
@Override
public void startLevel(int oneBasedLevelNumber) {
@@ -301,7 +323,7 @@ public final class LevelPlaytestBotTest {
public GameView.AutomationSnapshot snapshot() {
return new GameView.AutomationSnapshot(
completed, alive, doorOpen, false, moveRight || jump,
startedLevel, nowMillis, x, 760f, deaths, corpses);
startedLevel, nowMillis, x, y, deaths, corpses);
}
@Override
@@ -310,6 +332,7 @@ public final class LevelPlaytestBotTest {
if (!alive) {
alive = true;
x = 130f;
y = 760f;
} else if (deaths == 0 && moveRight && !jump) {
deaths = 1;
corpses = 1;
@@ -317,11 +340,24 @@ public final class LevelPlaytestBotTest {
doorOpen = true;
x = 570f;
} else if (moveRight && jump) {
if (x < 750f) {
sawTakeoffObserved = true;
y = 690f;
}
x += 60f;
} else if (moveRight && x < 390f) {
x = 400f;
x = overshootApproach ? 440f : 400f;
} else if (moveRight && x < 750f) {
x = 760f;
if (overshootApproach && !sawTakeoffObserved) {
deaths++;
corpses++;
alive = false;
x = 510f;
y = 780f;
} else {
x = 760f;
y = 760f;
}
} else if (moveRight && x < 1_390f) {
x = 1_500f;
} else if (moveRight) {