split Antworld into episodic and continuous task

- add new simple state for jumping dino, to see if convergence is guarenteed with with state representation
- changed reward structure for ant game
This commit is contained in:
2020-03-15 16:58:53 +01:00
parent 4641f50b79
commit ee1d62842d
21 changed files with 372 additions and 135 deletions
@@ -13,6 +13,9 @@ import java.awt.*;
*
* 350 states
* if 4 speed variants
*
* 2044
* 4 speeds, 4 distance
*/
public class DinoWorldAdvanced extends DinoWorld{
public DinoWorldAdvanced(){
@@ -21,7 +24,7 @@ public class DinoWorldAdvanced extends DinoWorld{
@Override
protected State generateReturnState() {
return new DinoStateWithSpeed(getDistanceToObstacle(), dino.isInJump(), getCurrentObstacle().getDx());
return new DinoStateWithSpeed(getDistanceToObstacle(), dino.isInJump(), currentObstacle.getDx());
}
@Override
@@ -30,16 +33,26 @@ public class DinoWorldAdvanced extends DinoWorld{
int xSpawn;
double ran = RNG.getRandom().nextDouble();
if(ran < 0.25){
dx = -(int)(0.7 * Config.OBSTACLE_SPEED);
dx = -(int) (0.35 * Config.OBSTACLE_SPEED);
}else if(ran < 0.5){
dx = -(int)(1.3 * Config.OBSTACLE_SPEED);
dx = -(int) (0.7 * Config.OBSTACLE_SPEED);
}else if(ran < 0.75){
dx = -(int)(1.6 * Config.OBSTACLE_SPEED);
} else{
dx = -2 * Config.OBSTACLE_SPEED;
dx = -(int) (3.5 * Config.OBSTACLE_SPEED);
}
double ran2 = RNG.getRandom().nextDouble();
if(ran2 < 0.25) {
// randomly spawning more right outside of the screen
xSpawn = Config.FRAME_WIDTH + Config.FRAME_WIDTH + Config.OBSTACLE_SIZE;
} else if(ran2 < 0.5) {
xSpawn = (int) (1.08 * Config.FRAME_WIDTH + Config.FRAME_WIDTH + Config.OBSTACLE_SIZE);
} else if(ran2 < 0.75) {
xSpawn = (int) (1.11 * Config.FRAME_WIDTH + Config.FRAME_WIDTH + Config.OBSTACLE_SIZE);
} else {
xSpawn = (int) (1.23 * Config.FRAME_WIDTH + Config.FRAME_WIDTH + Config.OBSTACLE_SIZE);
}
// randomly spawning more right outside of the screen
xSpawn = Config.FRAME_WIDTH + Config.FRAME_WIDTH + Config.OBSTACLE_SIZE;
currentObstacle = new Obstacle(Config.OBSTACLE_SIZE, xSpawn, Config.FRAME_HEIGHT - Config.GROUND_Y - Config.OBSTACLE_SIZE, dx, 0, Color.BLACK);
}
}