Стабилизировать бота уровня 10 при задержках
This commit is contained in:
@@ -53,11 +53,23 @@ public final class GameView extends View implements Runnable {
|
||||
private final float playerY;
|
||||
private final int deaths;
|
||||
private final int corpseCount;
|
||||
private final float firstMovingPlatformY;
|
||||
private final boolean playerOnMovingPlatform;
|
||||
|
||||
AutomationSnapshot(boolean completed, boolean playerAlive, boolean allDoorsOpen,
|
||||
boolean visiblyPaused, boolean inputActive, int levelNumber,
|
||||
long elapsedMilliseconds,
|
||||
float playerX, float playerY, int deaths, int corpseCount) {
|
||||
this(completed, playerAlive, allDoorsOpen, visiblyPaused, inputActive, levelNumber,
|
||||
elapsedMilliseconds, playerX, playerY, deaths, corpseCount,
|
||||
Float.NaN, false);
|
||||
}
|
||||
|
||||
AutomationSnapshot(boolean completed, boolean playerAlive, boolean allDoorsOpen,
|
||||
boolean visiblyPaused, boolean inputActive, int levelNumber,
|
||||
long elapsedMilliseconds,
|
||||
float playerX, float playerY, int deaths, int corpseCount,
|
||||
float firstMovingPlatformY, boolean playerOnMovingPlatform) {
|
||||
this.completed = completed;
|
||||
this.playerAlive = playerAlive;
|
||||
this.allDoorsOpen = allDoorsOpen;
|
||||
@@ -69,6 +81,8 @@ public final class GameView extends View implements Runnable {
|
||||
this.playerY = playerY;
|
||||
this.deaths = deaths;
|
||||
this.corpseCount = corpseCount;
|
||||
this.firstMovingPlatformY = firstMovingPlatformY;
|
||||
this.playerOnMovingPlatform = playerOnMovingPlatform;
|
||||
}
|
||||
|
||||
public boolean completed() { return completed; }
|
||||
@@ -82,6 +96,8 @@ public final class GameView extends View implements Runnable {
|
||||
public float playerY() { return playerY; }
|
||||
public int deaths() { return deaths; }
|
||||
public int corpseCount() { return corpseCount; }
|
||||
public float firstMovingPlatformY() { return firstMovingPlatformY; }
|
||||
public boolean playerOnMovingPlatform() { return playerOnMovingPlatform; }
|
||||
}
|
||||
|
||||
private static final class Player {
|
||||
@@ -1128,6 +1144,17 @@ public final class GameView extends View implements Runnable {
|
||||
if (level != null) {
|
||||
for (LevelDefinition.Door door : level.doors) allOpen &= doorOpen(door);
|
||||
}
|
||||
float firstMovingPlatformY = Float.NaN;
|
||||
for (PlatformState state : platformStates) {
|
||||
if (state.definition.isMoving()) {
|
||||
firstMovingPlatformY = state.y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean playerOnMovingPlatform = player.alive
|
||||
&& player.supportIndex >= 0
|
||||
&& player.supportIndex < platformStates.size()
|
||||
&& platformStates.get(player.supportIndex).definition.isMoving();
|
||||
return new AutomationSnapshot(
|
||||
screen == Screen.COMPLETE,
|
||||
player.alive,
|
||||
@@ -1139,7 +1166,9 @@ public final class GameView extends View implements Runnable {
|
||||
player.x,
|
||||
player.y,
|
||||
deaths,
|
||||
corpses.size()
|
||||
corpses.size(),
|
||||
firstMovingPlatformY,
|
||||
playerOnMovingPlatform
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user