From fa68e2e04aab534ee3eaa0eedd883ed574fca4bb Mon Sep 17 00:00:00 2001 From: "E.Gavrilov" Date: Tue, 18 Aug 2026 18:58:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BD=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BE=D1=87?= =?UTF-8?q?=D0=BD=D1=8B=D0=B5=20=D1=84=D0=BB=D0=B0=D0=BA=D0=B8=20=D1=84?= =?UTF-8?q?=D0=B8=D0=BD=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=B9=20=D0=BC=D0=B0?= =?UTF-8?q?=D1=82=D1=80=D0=B8=D1=86=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/LateLevelScenarios.java | 9 +++++--- .../game/EarlyLevelScenarios.java | 2 +- .../com/projectsacrifice/game/GameView.java | 23 +++++++++++++++++++ .../game/LevelPlaytestBotTest.java | 1 + 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/app/src/androidTest/java/com/projectsacrifice/game/LateLevelScenarios.java b/app/src/androidTest/java/com/projectsacrifice/game/LateLevelScenarios.java index 0cc41de..2335c23 100644 --- a/app/src/androidTest/java/com/projectsacrifice/game/LateLevelScenarios.java +++ b/app/src/androidTest/java/com/projectsacrifice/game/LateLevelScenarios.java @@ -17,7 +17,8 @@ final class LateLevelScenarios { LevelPlaytestBot.Input.rightJump(), snapshot -> snapshot.playerX() >= 640f) .step("Stand on the frozen block", 2_500L, LevelPlaytestBot.Input.none(), - snapshot -> snapshot.playerX() >= 626f + snapshot -> snapshot.playerOnGround() + && snapshot.playerX() >= 626f && snapshot.playerY() >= 668f && snapshot.playerY() <= 690f) .step("Land on the first ledge from the frozen block", 3_000L, @@ -277,7 +278,8 @@ final class LateLevelScenarios { && (snapshot.playerOnMovingPlatform() || (snapshot.playerY() >= 770f && !Float.isNaN(snapshot.firstMovingPlatformY()) - && snapshot.firstMovingPlatformY() >= 780f))) + && snapshot.firstMovingPlatformY() >= 750f + && snapshot.firstMovingPlatformMovingDown()))) .step("Take off toward the moving lift", 1_000L, LevelPlaytestBot.Input.rightJump(), snapshot -> snapshot.playerAlive() @@ -285,7 +287,8 @@ final class LateLevelScenarios { || snapshot.playerY() <= 670f)) .step("Board the moving lift", 2_000L, LevelPlaytestBot.Input.right(), - GameView.AutomationSnapshot::playerOnMovingPlatform) + LevelPlaytestBot.whileDeathsAtMost(3, + GameView.AutomationSnapshot::playerOnMovingPlatform)) .step("Brake toward the lift center", 1_000L, LevelPlaytestBot.Input.left(), snapshot -> snapshot.playerOnMovingPlatform() diff --git a/app/src/main/java/com/projectsacrifice/game/EarlyLevelScenarios.java b/app/src/main/java/com/projectsacrifice/game/EarlyLevelScenarios.java index 995941f..0432212 100644 --- a/app/src/main/java/com/projectsacrifice/game/EarlyLevelScenarios.java +++ b/app/src/main/java/com/projectsacrifice/game/EarlyLevelScenarios.java @@ -69,7 +69,7 @@ public final class EarlyLevelScenarios { .step("Approach the saw", 3_000L, LevelPlaytestBot.Input.right(), LevelPlaytestBot.whileDeathsAtMost(1, snapshot -> snapshot.playerAlive() && snapshot.playerOnGround() - && snapshot.playerX() >= 390f)) + && snapshot.playerX() >= 360f)) .step("Take off before the saw", 1_000L, LevelPlaytestBot.Input.rightJump(), LevelPlaytestBot.whileDeathsAtMost(1, snapshot -> snapshot.playerAlive() && !snapshot.playerOnGround() diff --git a/app/src/main/java/com/projectsacrifice/game/GameView.java b/app/src/main/java/com/projectsacrifice/game/GameView.java index 195fbea..87dcde9 100644 --- a/app/src/main/java/com/projectsacrifice/game/GameView.java +++ b/app/src/main/java/com/projectsacrifice/game/GameView.java @@ -60,6 +60,7 @@ public final class GameView extends View implements Runnable { private final boolean playerOnMovingPlatform; private final boolean firstMovingPlatformPowered; private final boolean firstMovingPlatformMovingRight; + private final boolean firstMovingPlatformMovingDown; private final float firstCorpseX; private final boolean playerOnGround; @@ -95,6 +96,23 @@ public final class GameView extends View implements Runnable { boolean firstMovingPlatformPowered, boolean firstMovingPlatformMovingRight, float firstCorpseX, boolean playerOnGround) { + this(completed, playerAlive, allDoorsOpen, visiblyPaused, inputActive, levelNumber, + elapsedMilliseconds, playerX, playerY, deaths, corpseCount, + firstMovingPlatformX, firstMovingPlatformY, playerOnMovingPlatform, + firstMovingPlatformPowered, firstMovingPlatformMovingRight, false, + firstCorpseX, playerOnGround); + } + + AutomationSnapshot(boolean completed, boolean playerAlive, boolean allDoorsOpen, + boolean visiblyPaused, boolean inputActive, int levelNumber, + long elapsedMilliseconds, + float playerX, float playerY, int deaths, int corpseCount, + float firstMovingPlatformX, float firstMovingPlatformY, + boolean playerOnMovingPlatform, + boolean firstMovingPlatformPowered, + boolean firstMovingPlatformMovingRight, + boolean firstMovingPlatformMovingDown, float firstCorpseX, + boolean playerOnGround) { this.completed = completed; this.playerAlive = playerAlive; this.allDoorsOpen = allDoorsOpen; @@ -111,6 +129,7 @@ public final class GameView extends View implements Runnable { this.playerOnMovingPlatform = playerOnMovingPlatform; this.firstMovingPlatformPowered = firstMovingPlatformPowered; this.firstMovingPlatformMovingRight = firstMovingPlatformMovingRight; + this.firstMovingPlatformMovingDown = firstMovingPlatformMovingDown; this.firstCorpseX = firstCorpseX; this.playerOnGround = playerOnGround; } @@ -131,6 +150,7 @@ public final class GameView extends View implements Runnable { public boolean playerOnMovingPlatform() { return playerOnMovingPlatform; } public boolean firstMovingPlatformPowered() { return firstMovingPlatformPowered; } public boolean firstMovingPlatformMovingRight() { return firstMovingPlatformMovingRight; } + public boolean firstMovingPlatformMovingDown() { return firstMovingPlatformMovingDown; } public float firstCorpseX() { return firstCorpseX; } public boolean playerOnGround() { return playerOnGround; } } @@ -1977,12 +1997,14 @@ public final class GameView extends View implements Runnable { float firstMovingPlatformY = Float.NaN; boolean firstMovingPlatformPowered = false; boolean firstMovingPlatformMovingRight = false; + boolean firstMovingPlatformMovingDown = false; for (PlatformState state : platformStates) { if (state.definition.isMoving()) { firstMovingPlatformX = state.x; firstMovingPlatformY = state.y; firstMovingPlatformPowered = signalActive(state.definition.controlId); firstMovingPlatformMovingRight = state.x > state.previousX; + firstMovingPlatformMovingDown = state.y > state.previousY; break; } } @@ -2007,6 +2029,7 @@ public final class GameView extends View implements Runnable { playerOnMovingPlatform, firstMovingPlatformPowered, firstMovingPlatformMovingRight, + firstMovingPlatformMovingDown, corpses.isEmpty() ? Float.NaN : corpses.get(0).x, player.onGround ); diff --git a/app/src/test/java/com/projectsacrifice/game/LevelPlaytestBotTest.java b/app/src/test/java/com/projectsacrifice/game/LevelPlaytestBotTest.java index 53774dc..9c6d456 100644 --- a/app/src/test/java/com/projectsacrifice/game/LevelPlaytestBotTest.java +++ b/app/src/test/java/com/projectsacrifice/game/LevelPlaytestBotTest.java @@ -137,6 +137,7 @@ public final class LevelPlaytestBotTest { assertTrue(Float.isNaN(snapshot.firstMovingPlatformY())); assertFalse(snapshot.playerOnMovingPlatform()); + assertFalse(snapshot.firstMovingPlatformMovingDown()); } @Test