亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? controller.java

?? ErGo是一個很早的Java通用圍棋服務(wù)器(IGS/NNGS)客戶端程序。有全部源碼和文檔
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
   * When the output of the games command is received we check to see if
   * the user is observing that game, and if so update the title of that game.
   *
   * this constructs Game Windows by use of handleMovesGame....
   * it issues the "moves" command to acquire the game history. AMB
   */
  protected void handleGames(ParsedMessage p) {
    skipwhite(p);
    String mess = p.rest();
    if (mess.indexOf("white name") != -1 && handleMovesGame == -1) {
      sgc.clear();
    }
    try {
      p.continueParse("[ %i ] %s [ %w ] vs. %s [ %w ] ( %i %i %i %f %i %w ) ( %i )");
      // fields ->       1    2    3        4    5      6  7  8  9  10  11    12
      int n = p.intAt(1);	// game number
      String w = p.stringAt(2);
      String b = p.stringAt(4);
      String flags = p.stringAt(11); // e.g., "FI" = Free, IGS rules.
      String acctName = client.getAccountName();
      boolean teachingGame = flags.indexOf("T") != -1;
      boolean freeGame = flags.indexOf("F") != -1;
      boolean playing = w.equals(acctName) || b.equals(acctName);
      int matchi = -1;
      if ((w.equals(b) && w.equals(acctName))
	  || (playing && teachingGame))
	matchi = Move.BOTH;
      else if (w.equals(acctName))
	matchi = Move.WHITE;
      else if (b.equals(acctName))
	matchi = Move.BLACK;
      // getGameWindowByName will invalidate any other window with
      // game# = n, and will update its title if necessary.
      GameWindow gwin = client.getGameWindowByName(w, b, n);

      String wr = p.stringAt(3);
      String br = p.stringAt(5);
      int size = p.intAt(7);
      int handi = p.intAt(8);
      double komi = p.doubleAt(9);
      int byotime = p.intAt(10);
      sgc.apply(p.stringAt(1), w, wr, b, br, p.stringAt(6),
		p.stringAt(7), p.stringAt(8), p.stringAt(9),
		p.stringAt(10), flags, p.stringAt(12), true);
      // problem here, no announcement of end of games.......!
      if (handleMovesGame != -1) { // this means that this issue of
				   // the games command is by handleMoves().
        countergames = true; // do not show the window after this.
	// handleMoves has just seen the first move for a new game.
	// The window is created here because the "games" command is
	// the only (?) place to find out the size of the game.  The
	// other needed info has already been saved in handleMovesMessage.
	// Issue a "moves" message for this game so the board will
	// get refreshed.
	gwin = client.addGameWindow(size, w, wr, b, br, komi, n, matchi, byotime, freeGame);
	conn.send("moves " + n, false);
        int waitingMove = p.intAt(6);
        if (waitingMove > 0) {
          waitingGameWindow = gwin;
          waitingMoveNumber = waitingMove;
          gwin.game.ss.setQuiet(true);
          seenmoveone = false;
        }
	handleMovesGame = -1;
      }
    }
    catch (ErgoException e) {}
  } // end method handleGames


  /*
   * Handle a prompt.  For reference, here is the list of prompt types from
   * the protocol document.
   *
   * LOGON	= 0,   initial state 
   * PASSWORD	= 1,   getting password 
   * PASSWD_NEW	= 2,   verifiying password: not used, registration 
   * PASSWD_CONFIRM	= 3,   ditto 
   * REGISTER	= 4,   not used 
   * WAITING	= 5,   After login the basic state 
   * PLAYING	= 6,   Playing a game 
   * SCORING	= 7,   Scoring a game 
   * OBSERVING	= 8,   Observing (and playing?) a game 
   * TEACHING	= 9,   In teaching mode, can move for W and B 
   * COMPLETE	= 10   game complete 
   */

  private int previousPrompt = 0;

  protected void handlePrompt(ParsedMessage p) {
    try {
      p.continueParse(" %i");
      int n = p.intAt(1);
      switch (n) {
      case 1:
	// Getting password (only if client was toggled on initially)
	client.displayString("Password: ", null, true);
	if (client.loginDialogExists()
	    && client.loginDialogDone()
	    && !client.passwordSent()) {
	  client.sendPassword();
	}
	break;
      case 7:
	if (n != previousPrompt && conn.server.isNNGStype()) {
	  // We just entered scoring mode.  On NNGS (as of 1998-01-17) there
	  // is a bug on NNGS such that the second Pass move in a row is not
	  // sent to both players in the game.  Instead the game goes directly
	  // into scoring mode by sending prompt 7.  This is not the case on
	  // IGS.  Since I use 2 Pass moves to know when to enter scoring
	  // mode (so that it will work the same in server games as it does
	  // in local games), this poses a problem.  Until the bug is fixed
	  // on NNGS (I reported it today) I will generate a Pass move here.
	  GameWindow gwin = client.getGameBeingPlayed();
	  Move parent = gwin.game.finalServerMove();
	  int movenum = parent.moveNumber() + 1;
	  int color = Move.nextColor(parent.color());
	  PassMove m = new PassMove(parent, 0, movenum, color, false);
	  // Why does this use handleMovesWindow rather than gwin?
	  handleMovesWindow.placeMove(m, true);
	}
	client.displayStringInActiveGame("Enter dead group:");
	break;
      default:
	conn.stopScanningForLogin();
	break;
      }
      previousPrompt = n;
    }
    catch (ErgoException e) { }
  }

  /*
   * Undo has two formats:
   *   While playing:    28 sigue undid the last move (C7).
   *   While observing:  28 Undo in game 6: vhdl vs snapback:  C9
   * It is then followed immediately by the previous move:
   *   15 Game 12 I: sigue (0 600 -1) vs sigue (0 600 -1)
   *   15   0(B): G3
   */
  protected void handleUndo(ParsedMessage p) {
    // Need to find out what game the undo is for...
    GameWindow gwin;
    try {
      // Is it the format of a game that's being observed?
      p.continueParse(" Undo in game %i: %a vs %a: %a");
      int gameNumber = p.intAt(1);
      String white = p.stringAt(2);
      String black = p.stringAt(3);
      client.undoMove(white, black, gameNumber);
    }
    catch (ParseException e) {
      // Not a game being observed, so must be playing a game.
      client.undoMove();
    }
  }


  /** 
    * Deal with "shouts", which are not just shouts.
    *
    * Examples:
    * {Game 16: smount vs cht : W 67.5 B 120.0}
    * {Game 15: fanzhen vs indigo : White resigns.}
    * {Game 15: fanzhen vs indigo : White forfeits on time.} // NNGS & IGS
    * {Game 15: fanzhen vs indigo : White lost by Time.}     // IGS
    * {Game 18: seanlarsen vs gremlin has adjourned.}
    * {Game 47: Allegro vs a11 @ Move 71}
    * {Match 15: kado [ 5k*] vs. anhui [ 6k*] }
    * {sisi [ 6k*] has connected.}
    * {cinnabar has disconnected.}
    * !JeryGarcia!: anyone 9x9, or 13x13 with 30k?
    */
  protected void handleShout (ParsedMessage p) {
    skipwhite(p);
    String message = p.rest();
    switch (message.charAt(0)) {
    case '{':
      try {
	// First case: end, resumption or adjournment of a game.
	if (message.regionMatches(true, 0, "{Game ", 0, 6)) {
	  p.continueParse("{Game %i: %a vs %a "); // What happend to "Match"? AMB
	  int gnum = p.intAt(1);
	  String white = p.stringAt(2);
	  String black = p.stringAt(3);
	  String rest = p.rest();
	  if (rest.indexOf("adjourned.}") != -1) { // case 1: adjourn
	    client.adjournGame(white, black, gnum);
	    sgc.disapply(gnum, white, black);
	    break;		// exit the switch
	  }
	  // Try to find out the SGF result of the game.
	  // Hold your nose...
	  String score = "";
	  String winner = "";
	  if (rest.indexOf(" B ") != -1) { // case 2: result
            if (client.isDisplayingGame(white, black, gnum)) {
	      try {
		// WING Note: A finished, scored game looks like this:
		// {Game 1: foo vs bar : W 82.5 B 76.0 White wins by 6.5.}
		// So this won't display the result correctly on WING.

		// The first two %s's are to strip off "White resigns."
		ParsedMessage ugh
		  = new ParsedMessage(rest, " : %s %s %s %f %s %f");
		double whiteScore = ugh.doubleAt(3);
		/* 
		  ParseException: Illegal field access - asked for 5.
		  at ParsedMessage.matchAt(util.java:598)
		  at Controller.handleShout(Controller.java:1028)
		  at Controller.dispatchMessage(Controller.java:275)
		  at Controller.run(Controller.java:157)
		  at java.lang.Thread.run(Thread.java:474)

		  The following call to matchAt blew out with the above.
		  The score was successfully displayed, but there was
		  no SGF result displayed.  I think the IGS messages
		  may have changed.
		  */
		double blackScore = ugh.doubleAt(5);
		score = "" + Math.abs(whiteScore - blackScore);
		winner = (whiteScore < blackScore) ? "B" : "W";
		client.resignGame(white, black, gnum, winner + "+" + score);
	      }
	      catch (ParseException grunt) {
		Debug.backtrace(grunt);
	      }
	    }
	    sgc.disapply(gnum, white, black);
	    break;		// exit the switch
          }
	  else if (rest.indexOf("resigns.}") != -1) { // case 3: resign
	    score = "Resign";
	    winner = (rest.indexOf("White") != -1) ? "B" : "W";
	    client.resignGame(white, black, gnum, winner + "+" + score);
	    sgc.disapply(gnum, white, black);
	    break;		// exit the switch
	  }
//     {Game 15: fanzhen vs indigo : White forfeits on time.} // NNGS & IGS
//     {Game 15: fanzhen vs indigo : White lost by Time.}     // IGS
// The latter is (I believe) only used on IGS for games that were
// replayed at the request of a user.  Need to verify this.
	  else if (rest.indexOf("forfeit") != -1 // case 4: time
		   || rest.indexOf("Time") != -1) { // IGS requested games.
	    score = "Time";
	    winner = (rest.indexOf("White") != -1) ? "B" : "W";
	    client.resignGame(white, black, gnum, winner + "+" + score);
	    sgc.disapply(gnum, white, black);
	    break;		// exit the switch
	  }
	  else if (rest.indexOf("@ Move") != -1) { // case 5: resume
            if (client.isDisplayingGame(white, black, gnum))
	      conn.send("observe " + gnum); // auto re-observe game.
	    p.continueParse("@ Move %i");
	    ServerPlayer spw = spc.byName(white);
	    ServerPlayer spb = spc.byName(black);
	    String wrank = (spw == null ? "??" : spw.rank.render());
	    String brank = (spb == null ? "??" : spb.rank.render());
	    sgc.apply(p.stringAt(1), white, wrank, black, brank, p.stringAt(4));
	  }			// end if resume
	}			// end if it is a message beginning "{Game"
	if (message.regionMatches(true, 0, "{Match ", 0, 7)) {
	  p.continueParse("{Match %i: %s [ %w ] vs. %s [ %w ]");
	  // Issue a "games n" command, to automatically update
	  // the "games" window when a new match starts.
	  // +++ The "games" window has to be modified for this to work.
	  //     Currently it erases everything except game n if I
	  //     issue a "games n" command.
	  //conn.send("games " + p.intAt(1));
	  sgc.apply(p.stringAt(1), p.stringAt(2), p.stringAt(3),
		    p.stringAt(4), p.stringAt(5));
	  // New games are important enough to display as terminal output.
	  client.displayString(message);
	}
	else if (message.indexOf(" has connected.}") != -1) {
	  p.continueParse("{%s [ %w ]");
	  spc.apply(p.stringAt(1), p.stringAt(2));
	}
	else if (message.indexOf(" has disconnected}") != -1) {
	  p.continueParse("{%s");
	  ServerPlayer sp = spc.byName(p.stringAt(1));
	  //          System.out.println(sp.name+" is gone");
	  spc.removePlayer(sp, false);
	}
      }				// end try block
      catch (ParseException e) {
        e.printStackTrace(System.out);
      }
      finally {
	// Always display this junk in the noise string area.
	client.displayNoiseString(message);
      }
      break;
    default:
      // If we get to here, I believe message is "!foo! blah blah blah"
      client.displayShout(message);
      break;
    }				// end switch on first character of message...
  }


  protected int[][] gameResult = null;
  protected String gameResultWhite = null;
  protected String gameResultBlack = null;
  private String gameResultWR = null;
  private String gameResultBR = null;
  private double gameResultKomi = 5.5f;

  /* Score looks like this: AMB
     22 Bosmon 25k  0 1570 23 F 5.5 0
     22 paulcc 25k  0 1781 24 F 5.5 0
     22  0: 222222222
     22  1: 222222222
     22  2: 226262022
     22  3: 220222222
     22  4: 226262622
     22  5: 222222222
     22  6: 226262122
     22  7: 222222222
     22  8: 222222222

     The first two lines are
     22 whitename rank n timeleft n T/F komi n

20 ogre (W:O): 57.5 to ogre (B:#): 8.0

20 ogre (W:O): 57.5 to ogre (B:#): 8.0
     */
  protected void handleScore (ParsedMessage pm) {
    String message = pm.rest();
    try {
      pm.continueParse(" %i: %a");
      int column = pm.intAt(1);
      String data = pm.stringAt(2);
      int size = data.length();	// assume square board
      if (gameResult == null) {
	gameResult = new int[size][size];
	for (int i = 0; i < size; i++)
	  for (int j = 0; j < size; j++)
	    gameResult[i][j] = -1;
      }
      for (int i = 0; i < size; i++) {
	char c = data.charAt(i);
	if (Character.isDigit(c))
	  gameResult[size - i - 1][column] = Character.digit(c, 10);
	else
	  break;
      }
      boolean done = (gameResultBlack != null && gameResultWhite != null);
    outer:
      for (int i = 0; i < size; i++)
	for (int j = 0; j < size; j++)
	  if (gameResult[i][j] == -1) {
	    done = false;
	    break outer;
	  }
      if (done) {
	GameWindow gwin = client.getGameWindowByName(gameResultWhite, gameResultBlack, -1);
	if (gwin == null) {
	  // If no game by this name, then this must be the "look" command.
	  // Create a local game with one move, the result.
	  gwin = client.createGame(size, gameResultWhite, gameResultWR,
				   gameResultBlack, gameResultBR, gameResultKomi);
	}
	// Place the move.  The second argument (fromServer) is false
	// because the server doesn't model the game result as a move
	// so it would cause problems if we modelled it as a server move.
	// (e.g., we might try to UNDO it on the server).  I don't think
	// it should cause a problem to treat it as a local move since at
	// the point this move is received the game is over.
	client.placeMove(gameResultWhite, gameResultBlack, -1,
			 new GameResultMove(gwin.game.finalServerMove(), gameResult),
			 false);	// this is a lie, technically.
	gameResult = null;
	gameResultBlack = null;
	gameResultWhite = null;
	gameResultWR = null;
	gameResultBR = null;
      }
    }
    catch (ParseException e) {
      try {
	// 22 Bosmon 25k  0 1570 23 F 5.5 0
	ParsedMessage pmess = new ParsedMessage(message, " %a %s %i %i %i %c %f %i");
	if (gameResultWhite == null) {
	  gameResultWhite = pmess.stringAt(0);
	  gameResultWR = pmess.stringAt(1);
	  gameResultKomi = pmess.doubleAt(6);
	}
	else if (gameResultBlack == null) {
	  gameResultBlack = pmess.stringAt(0);
	  gameResultBR = pmess.stringAt(1);
	}
      }
      catch (ParseException e1) { }
    }
  }


  // Display a yell as "<##:username> text ..."
  // Yell message format is "32 ##:username: text"
  protected void handleYell(ParsedMessage pm) {
    try {
      pm.continueParse(" %s ");
      String from = pm.stringAt(1);
      String text = pm.rest();
      from = from.substring(0, from.length() - 1);
      // +++ from includes the channel number.  should separate them.
      client.displayYell(from, text);
    }
    catch (ParseException pe) {
      client.displayString(pm.rest());
    }
  }

}				// end class Controller

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久久久久久久免费看 | 欧美日韩一区二区欧美激情| 懂色av一区二区三区免费看| 韩国精品主播一区二区在线观看| 久久精品免费观看| 精品一区二区在线视频| 黄一区二区三区| 精品无人码麻豆乱码1区2区 | 国产成人综合在线| 东方aⅴ免费观看久久av| 国产精品99久久久久久宅男| 国产成人高清视频| 成人永久免费视频| 91色|porny| 在线精品视频免费观看| 欧美日韩极品在线观看一区| 欧美精品成人一区二区三区四区| 欧美一级黄色片| 久久精品在线观看| 中文字幕一区二区三区四区不卡 | 国产一区二区看久久| 国产91清纯白嫩初高中在线观看| 99视频超级精品| 欧美午夜寂寞影院| 久久久精品中文字幕麻豆发布| 国产精品美女久久久久aⅴ| 国产精品欧美经典| 亚洲国产毛片aaaaa无费看| 奇米精品一区二区三区在线观看一| 精品一区二区免费看| 成人网页在线观看| 欧美伊人久久大香线蕉综合69 | 欧美精品一二三区| www亚洲一区| 亚洲手机成人高清视频| 亚洲自拍另类综合| 国产在线精品一区在线观看麻豆| 成人激情动漫在线观看| 欧美日韩电影一区| 精品sm捆绑视频| 亚洲色图欧美偷拍| 捆绑紧缚一区二区三区视频| 成人天堂资源www在线| 欧美中文字幕不卡| 国产午夜一区二区三区| 亚洲一区二区免费视频| 韩国中文字幕2020精品| 色婷婷精品大视频在线蜜桃视频| 日韩视频中午一区| 亚洲欧美日韩久久| 激情综合网激情| 在线看国产日韩| 国产清纯白嫩初高生在线观看91| 亚洲高清久久久| 成人在线视频一区| 欧美一个色资源| 一区二区三区在线免费| 国产精品一区二区在线播放| 欧美日韩激情在线| 最新中文字幕一区二区三区| 久久精品国产一区二区| 91福利在线免费观看| 久久久久久久久99精品| 秋霞电影一区二区| 欧美亚洲综合色| 国产精品久久久久久户外露出| 日本麻豆一区二区三区视频| 色噜噜久久综合| 中文字幕av资源一区| 久久国产精品露脸对白| 欧美放荡的少妇| 亚洲欧美一区二区三区极速播放| 国产精品亚洲一区二区三区妖精| 欧美日本国产一区| 亚洲日穴在线视频| 欧美乱熟臀69xxxxxx| 综合色天天鬼久久鬼色| 国产一区二区免费视频| 日韩你懂的电影在线观看| 亚洲男人天堂av| 9色porny自拍视频一区二区| 26uuu另类欧美亚洲曰本| 日韩高清国产一区在线| 欧美性大战久久久久久久蜜臀| 国产精品乱码一区二三区小蝌蚪| 狠狠色丁香婷婷综合| 日韩精品一区二区三区在线播放| 日韩激情视频在线观看| 欧美最新大片在线看| 亚洲综合成人在线| 色婷婷久久99综合精品jk白丝| 中文字幕一区二区三| 成人综合在线视频| 中文字幕 久热精品 视频在线| 国产成人在线网站| 国产精品视频线看| 成人av在线一区二区三区| 国产精品拍天天在线| 成人h版在线观看| 亚洲天堂免费看| 日本韩国精品一区二区在线观看| 综合网在线视频| 一本色道久久加勒比精品 | 国产成人免费在线视频| 久久久久久99久久久精品网站| 国产在线国偷精品免费看| 国产亚洲短视频| 成人国产亚洲欧美成人综合网 | 裸体歌舞表演一区二区| 欧美videos中文字幕| 国产精品资源在线| 国产精品久久久久久久久免费桃花 | 成人动漫一区二区在线| 综合色天天鬼久久鬼色| 欧美在线观看一二区| 无码av中文一区二区三区桃花岛| 欧美精品123区| 久久91精品国产91久久小草 | 午夜亚洲福利老司机| 91精品国产综合久久精品| 极品美女销魂一区二区三区免费 | 蜜桃av一区二区三区电影| 日韩欧美中文字幕制服| 国产精品亚洲а∨天堂免在线| 国产精品久久久久毛片软件| 91成人免费网站| 青青草97国产精品免费观看| 中文字幕综合网| 欧美日韩一卡二卡三卡| 另类小说图片综合网| 欧美国产一区二区| 色综合一区二区| 秋霞电影网一区二区| 国产欧美一区二区精品仙草咪| 色综合天天在线| 日本不卡不码高清免费观看| 久久久精品日韩欧美| 在线精品国精品国产尤物884a| 蜜臀久久久久久久| 国产精品午夜久久| 精品视频1区2区| 国产精华液一区二区三区| 一区二区在线观看av| 欧美电影免费观看高清完整版在线 | 免费在线一区观看| 国产精品乱码一区二区三区软件| 欧美三电影在线| 国产揄拍国内精品对白| 亚洲乱码中文字幕| 精品国产百合女同互慰| 色婷婷久久久亚洲一区二区三区| 美女视频黄a大片欧美| 最好看的中文字幕久久| 日韩欧美成人激情| 色噜噜狠狠色综合中国| 国产伦精品一区二区三区免费| 一区二区三区四区不卡在线| www成人在线观看| 欧美视频中文字幕| 国产宾馆实践打屁股91| 日本成人超碰在线观看| 亚洲女厕所小便bbb| 久久久99免费| 666欧美在线视频| 色域天天综合网| 国产高清不卡一区二区| 日韩专区一卡二卡| 一区二区三区在线视频观看 | 精一区二区三区| 亚洲一区二区三区视频在线| 日本一区二区高清| 日韩欧美成人午夜| 欧美挠脚心视频网站| 97se狠狠狠综合亚洲狠狠| 国内精品伊人久久久久av一坑| 亚洲3atv精品一区二区三区| 中文字幕在线不卡国产视频| 欧美sm美女调教| 91精品国产全国免费观看| 色综合久久中文综合久久97| 国产91在线观看| 国产一区二区精品久久91| 免费观看91视频大全| 亚洲电影一级黄| 亚洲精品成a人| 中文字幕在线一区免费| 欧美国产成人在线| 国产婷婷一区二区| 久久免费美女视频| 日韩欧美电影一二三| 国产精品免费aⅴ片在线观看| 精品久久99ma| 日韩欧美一区中文| 91精品午夜视频| 7777精品伊人久久久大香线蕉最新版| 色婷婷av一区| 欧美午夜影院一区| 欧美中文一区二区三区| 日本精品一级二级| 日本道免费精品一区二区三区|