Устранить нагрузочные флаки финальной матрицы
This commit is contained in:
@@ -17,7 +17,8 @@ final class LateLevelScenarios {
|
|||||||
LevelPlaytestBot.Input.rightJump(),
|
LevelPlaytestBot.Input.rightJump(),
|
||||||
snapshot -> snapshot.playerX() >= 640f)
|
snapshot -> snapshot.playerX() >= 640f)
|
||||||
.step("Stand on the frozen block", 2_500L, LevelPlaytestBot.Input.none(),
|
.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() >= 668f
|
||||||
&& snapshot.playerY() <= 690f)
|
&& snapshot.playerY() <= 690f)
|
||||||
.step("Land on the first ledge from the frozen block", 3_000L,
|
.step("Land on the first ledge from the frozen block", 3_000L,
|
||||||
@@ -277,7 +278,8 @@ final class LateLevelScenarios {
|
|||||||
&& (snapshot.playerOnMovingPlatform()
|
&& (snapshot.playerOnMovingPlatform()
|
||||||
|| (snapshot.playerY() >= 770f
|
|| (snapshot.playerY() >= 770f
|
||||||
&& !Float.isNaN(snapshot.firstMovingPlatformY())
|
&& !Float.isNaN(snapshot.firstMovingPlatformY())
|
||||||
&& snapshot.firstMovingPlatformY() >= 780f)))
|
&& snapshot.firstMovingPlatformY() >= 750f
|
||||||
|
&& snapshot.firstMovingPlatformMovingDown())))
|
||||||
.step("Take off toward the moving lift", 1_000L,
|
.step("Take off toward the moving lift", 1_000L,
|
||||||
LevelPlaytestBot.Input.rightJump(),
|
LevelPlaytestBot.Input.rightJump(),
|
||||||
snapshot -> snapshot.playerAlive()
|
snapshot -> snapshot.playerAlive()
|
||||||
@@ -285,7 +287,8 @@ final class LateLevelScenarios {
|
|||||||
|| snapshot.playerY() <= 670f))
|
|| snapshot.playerY() <= 670f))
|
||||||
.step("Board the moving lift", 2_000L,
|
.step("Board the moving lift", 2_000L,
|
||||||
LevelPlaytestBot.Input.right(),
|
LevelPlaytestBot.Input.right(),
|
||||||
GameView.AutomationSnapshot::playerOnMovingPlatform)
|
LevelPlaytestBot.whileDeathsAtMost(3,
|
||||||
|
GameView.AutomationSnapshot::playerOnMovingPlatform))
|
||||||
.step("Brake toward the lift center", 1_000L,
|
.step("Brake toward the lift center", 1_000L,
|
||||||
LevelPlaytestBot.Input.left(),
|
LevelPlaytestBot.Input.left(),
|
||||||
snapshot -> snapshot.playerOnMovingPlatform()
|
snapshot -> snapshot.playerOnMovingPlatform()
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public final class EarlyLevelScenarios {
|
|||||||
.step("Approach the saw", 3_000L, LevelPlaytestBot.Input.right(),
|
.step("Approach the saw", 3_000L, LevelPlaytestBot.Input.right(),
|
||||||
LevelPlaytestBot.whileDeathsAtMost(1, snapshot -> snapshot.playerAlive()
|
LevelPlaytestBot.whileDeathsAtMost(1, snapshot -> snapshot.playerAlive()
|
||||||
&& snapshot.playerOnGround()
|
&& snapshot.playerOnGround()
|
||||||
&& snapshot.playerX() >= 390f))
|
&& snapshot.playerX() >= 360f))
|
||||||
.step("Take off before the saw", 1_000L, LevelPlaytestBot.Input.rightJump(),
|
.step("Take off before the saw", 1_000L, LevelPlaytestBot.Input.rightJump(),
|
||||||
LevelPlaytestBot.whileDeathsAtMost(1, snapshot -> snapshot.playerAlive()
|
LevelPlaytestBot.whileDeathsAtMost(1, snapshot -> snapshot.playerAlive()
|
||||||
&& !snapshot.playerOnGround()
|
&& !snapshot.playerOnGround()
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public final class GameView extends View implements Runnable {
|
|||||||
private final boolean playerOnMovingPlatform;
|
private final boolean playerOnMovingPlatform;
|
||||||
private final boolean firstMovingPlatformPowered;
|
private final boolean firstMovingPlatformPowered;
|
||||||
private final boolean firstMovingPlatformMovingRight;
|
private final boolean firstMovingPlatformMovingRight;
|
||||||
|
private final boolean firstMovingPlatformMovingDown;
|
||||||
private final float firstCorpseX;
|
private final float firstCorpseX;
|
||||||
private final boolean playerOnGround;
|
private final boolean playerOnGround;
|
||||||
|
|
||||||
@@ -95,6 +96,23 @@ public final class GameView extends View implements Runnable {
|
|||||||
boolean firstMovingPlatformPowered,
|
boolean firstMovingPlatformPowered,
|
||||||
boolean firstMovingPlatformMovingRight, float firstCorpseX,
|
boolean firstMovingPlatformMovingRight, float firstCorpseX,
|
||||||
boolean playerOnGround) {
|
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.completed = completed;
|
||||||
this.playerAlive = playerAlive;
|
this.playerAlive = playerAlive;
|
||||||
this.allDoorsOpen = allDoorsOpen;
|
this.allDoorsOpen = allDoorsOpen;
|
||||||
@@ -111,6 +129,7 @@ public final class GameView extends View implements Runnable {
|
|||||||
this.playerOnMovingPlatform = playerOnMovingPlatform;
|
this.playerOnMovingPlatform = playerOnMovingPlatform;
|
||||||
this.firstMovingPlatformPowered = firstMovingPlatformPowered;
|
this.firstMovingPlatformPowered = firstMovingPlatformPowered;
|
||||||
this.firstMovingPlatformMovingRight = firstMovingPlatformMovingRight;
|
this.firstMovingPlatformMovingRight = firstMovingPlatformMovingRight;
|
||||||
|
this.firstMovingPlatformMovingDown = firstMovingPlatformMovingDown;
|
||||||
this.firstCorpseX = firstCorpseX;
|
this.firstCorpseX = firstCorpseX;
|
||||||
this.playerOnGround = playerOnGround;
|
this.playerOnGround = playerOnGround;
|
||||||
}
|
}
|
||||||
@@ -131,6 +150,7 @@ public final class GameView extends View implements Runnable {
|
|||||||
public boolean playerOnMovingPlatform() { return playerOnMovingPlatform; }
|
public boolean playerOnMovingPlatform() { return playerOnMovingPlatform; }
|
||||||
public boolean firstMovingPlatformPowered() { return firstMovingPlatformPowered; }
|
public boolean firstMovingPlatformPowered() { return firstMovingPlatformPowered; }
|
||||||
public boolean firstMovingPlatformMovingRight() { return firstMovingPlatformMovingRight; }
|
public boolean firstMovingPlatformMovingRight() { return firstMovingPlatformMovingRight; }
|
||||||
|
public boolean firstMovingPlatformMovingDown() { return firstMovingPlatformMovingDown; }
|
||||||
public float firstCorpseX() { return firstCorpseX; }
|
public float firstCorpseX() { return firstCorpseX; }
|
||||||
public boolean playerOnGround() { return playerOnGround; }
|
public boolean playerOnGround() { return playerOnGround; }
|
||||||
}
|
}
|
||||||
@@ -1977,12 +1997,14 @@ public final class GameView extends View implements Runnable {
|
|||||||
float firstMovingPlatformY = Float.NaN;
|
float firstMovingPlatformY = Float.NaN;
|
||||||
boolean firstMovingPlatformPowered = false;
|
boolean firstMovingPlatformPowered = false;
|
||||||
boolean firstMovingPlatformMovingRight = false;
|
boolean firstMovingPlatformMovingRight = false;
|
||||||
|
boolean firstMovingPlatformMovingDown = false;
|
||||||
for (PlatformState state : platformStates) {
|
for (PlatformState state : platformStates) {
|
||||||
if (state.definition.isMoving()) {
|
if (state.definition.isMoving()) {
|
||||||
firstMovingPlatformX = state.x;
|
firstMovingPlatformX = state.x;
|
||||||
firstMovingPlatformY = state.y;
|
firstMovingPlatformY = state.y;
|
||||||
firstMovingPlatformPowered = signalActive(state.definition.controlId);
|
firstMovingPlatformPowered = signalActive(state.definition.controlId);
|
||||||
firstMovingPlatformMovingRight = state.x > state.previousX;
|
firstMovingPlatformMovingRight = state.x > state.previousX;
|
||||||
|
firstMovingPlatformMovingDown = state.y > state.previousY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2007,6 +2029,7 @@ public final class GameView extends View implements Runnable {
|
|||||||
playerOnMovingPlatform,
|
playerOnMovingPlatform,
|
||||||
firstMovingPlatformPowered,
|
firstMovingPlatformPowered,
|
||||||
firstMovingPlatformMovingRight,
|
firstMovingPlatformMovingRight,
|
||||||
|
firstMovingPlatformMovingDown,
|
||||||
corpses.isEmpty() ? Float.NaN : corpses.get(0).x,
|
corpses.isEmpty() ? Float.NaN : corpses.get(0).x,
|
||||||
player.onGround
|
player.onGround
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ public final class LevelPlaytestBotTest {
|
|||||||
|
|
||||||
assertTrue(Float.isNaN(snapshot.firstMovingPlatformY()));
|
assertTrue(Float.isNaN(snapshot.firstMovingPlatformY()));
|
||||||
assertFalse(snapshot.playerOnMovingPlatform());
|
assertFalse(snapshot.playerOnMovingPlatform());
|
||||||
|
assertFalse(snapshot.firstMovingPlatformMovingDown());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user