示例#1
0
  /**
   * Have the computer play against itself, putting output int the default Java console. You can
   * also have your new AI player play from here, with no GUI output. It may be useful for testing.
   * If you want a human to play, use GUI.main.
   */
  public static void main(String[] args) {
    /* p1 is the first player, p2 is the second player. This is set to
     * have to Dummy players--playing randomly.
     * To play the game with your own AI object, use assignments like you
     * see in the comments after these two assignments. In those assignments,
     * the second argument of the constructor is the depth to which AI
     * searches the game space. */
    Solver p1 = new Dummy(Board.Player.RED);
    Solver p2 = new Dummy(Board.Player.YELLOW);

    // Solver p1= new AI(Board.Player.RED, 5);
    // Solver p2= new AI(Board.Player.YELLOW, 5);

    Game game = new Game(p1, p2);
    game.runGame();

    // testGetPossibleMoves();
    // Board a = new Board();
    // State y = new State(Board.Player.RED, a, null);
    // y.initializeChildren();
    // testInitializeChildren(y);

    Board b = new Board();
    State newState = new State(Board.Player.RED, b, null);
    AI ai = new AI(Board.Player.RED, 2);
    ai.createGameTree(newState, 2);
    ai.minimax(newState);
    newState.writeToFile();
  }
示例#2
0
  public static void main(String[] args) {
    int[] whiteValues = {1, 3, 3, 5, 9, 2};
    int[] blackValues = {1, 3, 3, 5, 9, 2};

    AIOptions whiteOptions = new AIOptions(whiteValues);
    AIOptions blackOptions = new AIOptions(blackValues);

    Game currentGame =
        new Game(Definitions.AI_PLAYER, whiteOptions, Definitions.AI_PLAYER, blackOptions);
    currentGame.runGame();
  }
示例#3
0
文件: Main.java 项目: ersefa/P2
  /**
   * Main method
   *
   * @param args Execution arguments
   */
  public static void main(String[] args) {

    /** Stream Input/Output configuration */
    streamIn = System.in;
    streamOut = System.out;

    Game game = new Game();
    if (game.init(streamIn, streamOut)) game.runGame();
    else {
      PrintStream ps = new PrintStream(streamOut);
      ps.println("Intitialization Error");
    }
  }
示例#4
0
 public static void main(String[] args) {
   while (true) {
     Game gamNew = new Game("GameConfig.xml");
     gamNew.runGame();
   }
 }