Package minesweeper.ai.games

Examples of minesweeper.ai.games.GameState


    }
   
    System.out.print("\nEasy\t");
    int[] wins = new int[players.length];
    for(int i=0; i<1000; i++) {
      GameState game = NativeGameState.createEasyGame();
      for(int p=0; p<players.length; p++) {
        players[p].solve(game);
        if(game.getState()==State.WIN) wins[p]++;
        game.restart();
      }
    }
    for(int w : wins) System.out.print("\t\t"+w);
   
    System.out.print("\nIntermediate");
    wins = new int[players.length];
    for(int i=0; i<1000; i++) {
      GameState game = NativeGameState.createIntermediateGame();
      for(int p=0; p<players.length; p++) {
        players[p].solve(game);
        if(game.getState()==State.WIN) wins[p]++;
        game.restart();
      }
    }
    for(int w : wins) System.out.print("\t\t"+w);
   
    System.out.print("\nAdvanced");
    wins = new int[players.length];
    for(int i=0; i<1000; i++) {
      GameState game = NativeGameState.createAdvancedGame();
      for(int p=0; p<players.length; p++) {
        players[p].solve(game);
        if(game.getState()==State.WIN) wins[p]++;
        game.restart();
      }
    }
    for(int w : wins) System.out.print("\t\t"+w);
   
    System.out.println("\n"+(System.currentTimeMillis()-t0));
View Full Code Here


 
  public static void evaluateAI(AIPlayer player, int trials) {
    System.out.println("Evaluation of " + player);
    int[][] results = new int[3][2]; //[easy/med/adv][win/lose]
    for(int i=0; i < trials; i++) {
      GameState game = NativeGameState.createEasyGame();
      player.solve(game);
      results[0][game.getState()==State.WIN?0:1]++;
    }
    System.out.println("Easy: ");
    System.out.println("\tWins: " + results[0][0] + "\n\tLosses: " + results[0][1]);
    for(int i=0; i < trials; i++) {
      GameState game = NativeGameState.createIntermediateGame();
      player.solve(game);
      results[1][game.getState()==State.WIN?0:1]++;
    }
    System.out.println("Intermediate: ");
    System.out.println("\tWins: " + results[1][0] + "\n\tLosses: " + results[1][1]);
    for(int i=0; i < trials; i++) {
      GameState game = NativeGameState.createAdvancedGame();
      player.solve(game);
      results[2][game.getState()==State.WIN?0:1]++;
    }
    System.out.println("Advanced: ");
    System.out.println("\tWins: " + results[2][0] + "\n\tLosses: " + results[2][1]);
  }
View Full Code Here

public class MinesweeperApplication {
 
  public static void main(String... args) throws IOException, InterruptedException {
   
    GameState game = Windows7GameState.createAdvancedGame();
   
    AIPlayer player = new ProbablisticSearchTreeAI(DebugMode.ON);
    player.solve(game);
    Thread.sleep(3333);
    System.out.println(game.getState());
   
  }
View Full Code Here

TOP

Related Classes of minesweeper.ai.games.GameState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.