Search in sources :

Example 61 with ElapsedTimer

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);
}
Also used : GameParameters(evogame.GameParameters) DefaultParams(evogame.DefaultParams) ElapsedTimer(utilities.ElapsedTimer)

Example 62 with ElapsedTimer

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);
// }
}
Also used : GameParameters(evogame.GameParameters) ElapsedTimer(utilities.ElapsedTimer)

Example 63 with ElapsedTimer

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");
}
Also used : Random(java.util.Random) Gson(com.google.gson.Gson) ElapsedTimer(utilities.ElapsedTimer)

Aggregations

ElapsedTimer (utilities.ElapsedTimer)63 StatSummary (utilities.StatSummary)27 Random (java.util.Random)12 SimpleRMHC (ga.SimpleRMHC)9 Types (ontology.Types)9 ElapsedCpuTimer (tools.ElapsedCpuTimer)9 EvoAlg (evodef.EvoAlg)7 NTupleBanditEA (ntuple.NTupleBanditEA)7 JEasyFrame (utilities.JEasyFrame)7 ArrayList (java.util.ArrayList)6 AbstractPlayer (core.player.AbstractPlayer)5 Gson (com.google.gson.Gson)4 Agent (controllers.singlePlayer.ea.Agent)4 StateObservationMulti (core.game.StateObservationMulti)4 StateObservation (core.game.StateObservation)3 AbstractMultiPlayer (core.player.AbstractMultiPlayer)3 GameParameters (evogame.GameParameters)3 ConvNTuple (ntuple.ConvNTuple)3 SlidingMeanEDA (ntuple.SlidingMeanEDA)3 SimpleMaxGame (altgame.SimpleMaxGame)2