コード例 #1
0
  /**
   * The main method. Several options are listed - simply remove comments to use the option you
   * want.
   *
   * @param args the command line arguments
   */
  public static void main(String[] args) {
    Executor exec = new Executor();

    // run multiple games in batch mode - good for testing.
    int numTrials = 10;
    // exec.runExperiment(new RandomPacMan(),new RandomGhosts(),numTrials);

    /*
    //run a game in synchronous mode: game waits until controllers respond.
    int delay=5;
    boolean visual=true;
    exec.runGame(new RandomPacMan(),new RandomGhosts(),visual,delay);
    		 */

    /// *
    // run the game in asynchronous mode.
    boolean visual = true;
    //		exec.runGameTimed(new NearestPillPacMan(),new AggressiveGhosts(),visual);
    //		exec.runGameTimed(new StarterPacMan(),new StarterGhosts(),visual);
    //		exec.runGameTimed(new HumanController(new KeyBoardInput()),new StarterGhosts(),visual);
    // */

    /*
    //run the game in asynchronous mode but advance as soon as both controllers are ready  - this is the mode of the competition.
    //time limit of DELAY ms still applies.
    boolean visual=true;
    boolean fixedTime=false;
    exec.runGameTimedSpeedOptimised(new RandomPacMan(),new RandomGhosts(),fixedTime,visual);
    */

    /*
    //run game in asynchronous mode and record it to file for replay at a later stage.
    boolean visual=true;
    String fileName="replay.txt";
    exec.runGameTimedRecorded(new HumanController(new KeyBoardInput()),new RandomGhosts(),visual,fileName);
    //exec.replayGame(fileName,visual);
     */

    // run game for data collection
    // exec.runGameTimed(new DataCollectorController(new KeyBoardInput()), new AggressiveGhosts(),
    // visual);

    // Ejecutamos el juego con el controlador de QLearning y con las repeticiones que configuramos
    // A modo orientativo 2000 repeticiones tarda unos 40 segundos en ser ejecutadas
    int repeticiones = 2000;
    exec.runQLearner(new StarterPacMan(), new QController(), repeticiones);
  }
コード例 #2
0
ファイル: Executor.java プロジェクト: eiisolver/pacman2012
  /**
   * The main method. Several options are listed - simply remove comments to use the option you
   * want.
   *
   * @param args the command line arguments
   */
  public static void main(String[] args) {
    Executor exec = new Executor();

    /*
    //run multiple games in batch mode - good for testing.
    int numTrials=10;
    exec.runExperiment(new RandomPacMan(),new RandomGhosts(),numTrials);
     */

    /*
    //run a game in synchronous mode: game waits until controllers respond.
    int delay=5;
    boolean visual=true;
    exec.runGame(new RandomPacMan(),new RandomGhosts(),visual,delay);
    		 */

    /// *
    // run the game in asynchronous mode.
    boolean visual = true;
    // exec.runGameTimed(new MyPacMan(),new MyGhostsV3(),visual);
    // exec.runGame(new MyPacMan(),new StarterGhosts(),visual, 5);
    // exec.runGame(new MyPacMan(),new AggressiveGhosts(),visual, 5);
    // exec.runGame(new MyPacMan(),new Legacy(),visual, 5);
    // exec.runGame(new MyPacMan(),new Legacy2TheReckoning(),visual, 5);
    exec.runGame(new MyPacMan(), new MyGhosts(), visual, 5);
    // exec.runGameTimed(new HumanController(new KeyBoardInput()),new MyGhosts(),visual);
    // */
    String fileName = "replay.txt";
    // exec.runGameTimedRecorded(new MyPacMan(),new StarterGhosts(),false,fileName);
    // exec.replayGame(fileName,visual);
    /*
    //run the game in asynchronous mode but advance as soon as both controllers are ready  - this is the mode of the competition.
    //time limit of DELAY ms still applies.
    boolean visual=true;
    boolean fixedTime=false;
    exec.runGameTimedSpeedOptimised(new RandomPacMan(),new RandomGhosts(),fixedTime,visual);
    */

    /*
    //run game in asynchronous mode and record it to file for replay at a later stage.
    boolean visual=true;
    String fileName="replay.txt";
    exec.runGameTimedRecorded(new HumanController(new KeyBoardInput()),new RandomGhosts(),visual,fileName);
    //exec.replayGame(fileName,visual);
     */
  }
コード例 #3
0
 // Funcion para evaluar un individuo
 // Lo que hacemos es ejecutar el juego NUM_EVALUACIONES veces y obtenemos la puntuacion media,
 // siendo esta el fitness del individuo
 public void evaluarGenotipo() {
   Executor exec = new Executor();
   ControladorFuzzyGen controlador =
       new ControladorFuzzyGen(
           this); // Creamos un controlador borroso y le pasamos nuestro individuo
   mFitness =
       (float)
           exec.runGenetico(
               controlador,
               GHOST_CONTROLLER,
               NUM_EVALUACIONES); // Ejecutamos el juego en modo experiment sin interfaz para
   // obtener la puntuacion media
   mFenotipo =
       controlador
           .getEngine(); // Le asignamos el fenotipo al individuo (el motor usado en el controlador
   // borroso para su evaluacion)
   evaluado =
       true; // Seteamos a true la variable para saber que este individuo ya ha sido evaluado
 }