use of utilities.ElapsedTimer in project SimpleAsteroids by ljialin.
the class EvoAgentTest method main.
// todo: fix an error where whne an Asteroid is hit, it all goes crazy
// like it fails to remove the dead ones
// which is actually exactly what does happen!!
public static void main(String[] args) {
ElapsedTimer timer = new ElapsedTimer();
boolean visible = false;
int nTicks = 1000;
int startLevel = 1;
int nLives = 3;
GameParameters params = new GameParameters().injectValues(new DefaultParams());
AsteroidsGameState gameState = new AsteroidsGameState().setParams(params);
gameState.initialLevel = 5;
Game game = new Game(gameState, visible);
gameState.forwardModel.nLives = nLives;
Game.copyTest = false;
ElapsedTimer t = new ElapsedTimer();
game.run(nTicks);
System.out.println(t);
System.out.println(timer);
}
use of utilities.ElapsedTimer in project SimpleAsteroids by ljialin.
the class Game method main.
public static void main(String[] args) {
System.out.println(font);
boolean visible = true;
int nTicks = 20000;
int startLevel = 4;
int nLives = 5;
GameParameters params = new GameParameters();
// AsteroidsGameState gameState = new AsteroidsGameState(params, startLevel, nLives);
AsteroidsGameState gameState = new AsteroidsGameState().setParams(params).initForwardModel();
Game game = new Game(gameState, visible);
ElapsedTimer t = new ElapsedTimer();
System.out.println("Level = " + gameState.forwardModel.level);
game.run(nTicks);
System.out.println(t);
// if (visible) {
// gameState.run(nTicks);
// } else {
// ElapsedTimer t = new ElapsedTimer();
// gameState.runHeadless(nTicks);
// System.out.println(t);
// }
}
use of utilities.ElapsedTimer in project SimpleAsteroids by ljialin.
the class JsonTest method main.
public static void main(String[] args) {
int nSteps = 10;
int nPlayers = 2;
int[] actions = new int[nPlayers];
Gson gson = new Gson();
Random rand = new Random();
SimpleBattleState state = new SimpleBattleState();
ElapsedTimer t = new ElapsedTimer();
for (int i = 0; i < nSteps; i++) {
for (int j = 0; j < nPlayers; j++) {
actions[j] = rand.nextInt(state.nActions());
}
// now advance the game to the next step
state.next(actions);
String out = gson.toJson(state);
System.out.println(out);
}
System.out.println(t);
System.out.println();
System.out.println(nSteps + " states written");
}
Aggregations