예제 #1
0
파일: Board.java 프로젝트: ankeshs/hex
  void newGame() {
    ptm = null;
    NewGame ngd = new NewGame(this);
    ngd.setVisible(true);
    if (ngd.gst == null) {
      if (firstrun) {
        bst = new BoardSettings();
        gst = new GameSettings();
        bst.setOrder(13);
        gst.setType(0);
        gst.swap = false;
        firstrun = false;
      } else return;
    } else {
      bst = ngd.bst;
      gst = ngd.gst;
      firstrun = false;
    }

    bst.findScale(getSize());
    x0 = bst.scale * r3 * (bst.getOrder() + 4) / 2;
    y0 = bst.scale * r3 * 2 + 50;

    data = new GameData(bst.getOrder());
    getCoordinates();
    /*if(gst.ai!=null)
    {
        gst.ai.flush();
        gst.ai.start();
    }*/
    gameActive = true;
    count = 0;
    lmv = null;
    AIMethods.init(bst.getOrder());
    if (gst.getType() == GameSettings.HUMAN_VS_AI) {
      if (gst.ai == null) gst.ai = new MiniMax(bst.getOrder(), (cst == 1) ? 2 : 1);
      gst.ai.init(this);
      userMove = true;
    }
    AePlayWave.q.clear();
    if (gst.audio) AePlayWave.play(AePlayWave.START);
    repaint();
  }