{"id":36,"date":"2013-09-06T04:12:18","date_gmt":"2013-09-06T04:12:18","guid":{"rendered":""},"modified":"2013-09-06T04:12:18","modified_gmt":"2013-09-06T04:12:18","slug":"","status":"publish","type":"post","link":"http:\/\/weizn.net\/?p=36","title":{"rendered":"AI\u7248\u4e94\u5b50\u68cb"},"content":{"rendered":"<pre class=\"brush:java; toolbar: true; auto-links: true;\">\u4f7f\u7528\u4e86\u535a\u5f08\u6811\u548c\u526a\u679d\u7b97\u6cd5\uff0c\u81f3\u4e8e\u6c34\u5e73\u5982\u4f55\uff0c\u53cd\u6b63\u4f5c\u4e3a\u4f5c\u8005\u6211\u662f\u4e0b\u4e0d\u8fc7\u5b83\u3002<\/pre>\n<pre class=\"brush:java; toolbar: true; auto-links: true;\">\r\n<\/pre>\n<pre class=\"brush:java; toolbar: true; auto-links: true;\">\r\n<\/pre>\n<pre class=\"brush:java; toolbar: true; auto-links: true;\"><\/pre>\n<pre class=\"brush:java; toolbar: true; auto-links: true;\"><\/pre>\n<pre class=\"brush:java; toolbar: true; auto-links: true;\">=================Main.java=====================\r\nimport java.awt.Color;\r\nimport java.awt.Graphics;\r\nimport java.awt.event.MouseEvent;\r\nimport java.awt.event.MouseListener;\r\nimport javax.swing.JFrame;\r\n\r\npublic class Main extends JFrame implements MouseListener {\r\n\r\n int AI_WIN, PEROP_WIN;\r\n int Winning; \/\/ \u80dc\u7387\r\n boolean draw_chessboard = true, draw_chess = false;\r\n boolean init = true;\r\n boolean AI_play = false;\r\n int winner = 0;\r\n int x, y; \/\/ \u68cb\u5b50\u5750\u6807\r\n int _x, _y; \/\/ \u9f20\u6807\u6307\u9488\u5750\u6807\r\n int count = 0;\r\n int[][] chess = new int[23][23];\r\n\r\n int w = 26; \/\/ \u8bbe\u7f6e\u6bcf\u4e2a\u683c\u5b50\u7684\u95f4\u8ddd\r\n int px = 100, py = 100;\r\n int pxw = (px + w), pyw = (py + w); \/\/ \u8bbe\u7f6e\u6bcf\u4e2a\u683c\u5b50\u7684\u95f4\u8ddd\r\n int width = w * 22, height = w * 22;\r\n int vline = (width + px);\r\n int hline = (height + py);\r\n AI computer = new AI();\r\n Thread thread = new Thread();\r\n String statistics = new String();\r\n\r\n public Main() {\r\n  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n  this.addMouseListener(this);\r\n  this.setSize(900, 750);\r\n  this.setVisible(true);\r\n }\r\n\r\n public void paint(Graphics Graph) {\r\n  if (draw_chessboard) {\r\n   Graph.clearRect(0, 0, this.getWidth(), this.getHeight()); \/\/ \u6e05\u9664\u9762\u677f\r\n   Graph.setColor(Color.green);\/\/ \u8bbe\u7f6e\u68cb\u76d8\u7684\u989c\u8272\r\n   Graph.fill3DRect(px, py, width, height, true);\/\/ \u8bbe\u7f6e\u68cb\u76d8\u4f4d\u7f6e\r\n   Graph.setColor(Color.black); \/\/ \u8bbe\u7f6e\u7f51\u683c\u989c\u8272\r\n   Graph.drawRect(px, py, width, height);\/\/ \u8bbe\u7f6e\u9762\u677f\u7684\u8fb9\u754c\r\n   Graph.drawString(\"\u4e94\u5b50\u68cb\u2014\u2014AI\u7248\", 110, 70);\/\/ \u8bbe\u7f6e\u6807\u9898\r\n\r\n   \/**\r\n    * \u753b\u6bcf\u6761\u6a2a\u7ebf\u548c\u7ad6\u7ebf\r\n    *\/\r\n   for (int i = 0; i &lt; 21; i++) {\r\n    Graph.drawLine(pxw + i * w, py, pxw + i * w, hline); \/\/ \u753b\u7ad6\u7ebf\r\n    Graph.drawLine(px, pyw + i * w, vline, pyw + i * w); \/\/ \u753b\u6a2a\u7ebf\r\n   }\r\n   init = true;\r\n   draw_chessboard = false; \/\/ \u8868\u793a\u68cb\u76d8\u5df2\u7ecf\u753b\u597d\r\n  }\r\n  if (init) {\r\n   count = 1;\r\n   _x = _y = x = y = 386;\r\n   draw_chess = true;\r\n   chess[11][11] = 1; \/\/ \u8bbe\u7f6e\u4e2d\u95f4\u4f4d\u7f6e\u4e3a\u9ed1\u5b50\r\n   init = false;\r\n  }\r\n\r\n  statistics = String.format(\"\u7535\u8111\u80dc\u4e86%d\u5c40\", AI_WIN);\r\n  Graph.clearRect(700, 120, 140, 25);\r\n  Graph.setColor(Color.BLUE);\r\n  Graph.drawString(statistics, 700, 125);\r\n\r\n  statistics = String.format(\"\u4f60\u80dc\u4e86%d\u5c40\", PEROP_WIN);\r\n  Graph.clearRect(700, 150, 140, 25);\r\n  Graph.setColor(Color.BLUE);\r\n  Graph.drawString(statistics, 700, 155);\r\n\r\n  if (AI_WIN == 0 &amp;&amp; PEROP_WIN &gt; 0)\r\n   Winning = 100;\r\n  else if (AI_WIN == 0 &amp;&amp; PEROP_WIN == 0)\r\n   Winning = 0;\r\n  else {\r\n   Winning = (int) (((double) PEROP_WIN \/ (double) (AI_WIN + PEROP_WIN)) * 100);\r\n  }\r\n  statistics = String.format(\"\u4f60\u7684\u80dc\u7387%d%%\", Winning);\r\n  Graph.clearRect(700, 180, 140, 25);\r\n  Graph.setColor(Color.BLUE);\r\n  Graph.drawString(statistics, 700, 185);\r\n\r\n  Graph.clearRect(580, 50, 140, 25); \/\/ \u64e6\u9664\u4e0a\u6b21\u6d88\u606f\r\n  Graph.clearRect(350, 690, 100, 25);\r\n  if (count == 2) {\r\n   Graph.setColor(Color.black);\r\n   Graph.drawString(\"\u8f6e\u5230\u9ed1\u68cb\u843d\u5b50\", 350, 700);\r\n   Graph.setColor(Color.WHITE);\r\n  } else {\r\n   Graph.setColor(Color.black);\r\n   Graph.drawString(\"\u8f6e\u5230\u767d\u68cb\u843d\u5b50\", 350, 700);\r\n   Graph.setColor(Color.BLACK);\r\n  }\r\n  if ((_x &gt;= 100 &amp;&amp; _x &lt;= 672) &amp;&amp; (_y &gt;= 100 &amp;&amp; _y &lt;= 672)) \/\/ \u5224\u65ad\u843d\u5b50\u5750\u6807\u662f\u5426\u5728\u68cb\u76d8\u5185\r\n  {\r\n   if (draw_chess) {\r\n    Graph.fillArc(x - w \/ 2, y - w \/ 2, w, w, 0, 360); \/\/ \u7ed9\u5706\u586b\u5145\u989c\u8272\r\n   } else {\r\n    Graph.setColor(Color.red);\r\n    Graph.drawString(\"\u8bf7\u4e0d\u8981\u91cd\u590d\u843d\u5b50\", 580, 70);\r\n   }\r\n  } else {\r\n   Graph.setColor(Color.red);\r\n   Graph.drawString(\"\u8bf7\u843d\u5b50\u5728\u68cb\u76d8\u5185\", 580, 70);\r\n  }\r\n  if (winner != 0) {\r\n   if (winner == 2) {\r\n    Graph.setColor(Color.red);\r\n    Graph.drawString(\"\u606d\u559c\uff01\u4f60\u8d62\u4e86\u3002\", 580, 70);\r\n    PEROP_WIN++;\r\n    draw_chessboard = true; \/\/ \u9700\u8981\u91cd\u65b0\u753b\u68cb\u76d8\r\n    winner = 0;\r\n    AI_play = false;\r\n    for (int y = 0; y &lt; 23; y++) {\r\n     for (int x = 0; x &lt; 23; x++) {\r\n      chess[x][y] = 0; \/\/ \u521d\u59cb\u5316\u68cb\u76d8\u5e03\u5c40\r\n     }\r\n    }\r\n    return;\r\n   } else {\r\n    Graph.setColor(Color.red);\r\n    Graph.drawString(\"\u7535\u8111\u8d62\u4e86\uff01\", 580, 70);\r\n    AI_WIN++;\r\n    winner = 0;\r\n    AI_play = false;\r\n    draw_chessboard = true;\r\n    for (int y = 0; y &lt; 23; y++) {\r\n     for (int x = 0; x &lt; 23; x++) {\r\n      chess[x][y] = 0;\r\n     }\r\n    }\r\n    return;\r\n   }\r\n  }\r\n  if (AI_play) {\r\n   AI_play();\r\n   count = 1;\r\n   AI_play = false;\r\n   this.repaint();\r\n   return;\r\n  }\r\n }\r\n\r\n @Override\r\n \/\/ \u83b7\u53d6\u9f20\u6807\u4e8b\u4ef6\r\n public void mouseClicked(MouseEvent e) {\r\n\r\n  int m, n;\r\n\r\n  \/\/ \u83b7\u53d6\u9f20\u6807\u6307\u9488\u7684\u5750\u6807\r\n  _x = e.getX();\r\n  _y = e.getY();\r\n\r\n  if (draw_chessboard) {\r\n   _x = _y = x = y = 0;\r\n  }\r\n  \/\/ \u5224\u65ad\u843d\u5b50\u662f\u5426\u5728\u68cb\u76d8\u5185\r\n  if ((_x - 100 &gt;= 0) &amp;&amp; (_x - 100) &lt;= 572 &amp;&amp; (_y - 100 &gt;= 0)\r\n    &amp;&amp; (_y - 100 &lt;= 572)) {\r\n   \/\/ \u5224\u65ad\u843d\u5b50\u5728\u54ea\u4e2a\u4f4d\u7f6e\r\n   for (m = 0; m &lt;= 22; m++) {\r\n    if ((_x - (100 + 26 * m)) &lt;= 10) { \/\/ \u5f97\u5230\u843d\u5b50\u70b9Y\u5750\u6807\r\n     x = 100 + 26 * m;\r\n     break;\r\n    }\r\n   }\r\n   for (n = 0; n &lt;= 22; n++) {\r\n    if ((_y - (100 + 26 * n)) &lt;= 10) { \/\/ \u5f97\u5230\u843d\u5b50\u70b9Y\u5750\u6807\r\n     y = 100 + 26 * n;\r\n     break;\r\n    }\r\n   }\r\n   \/\/ \u5224\u65ad\u843d\u5b50\u5904\u662f\u5426\u5df2\u6709\u68cb\u5b50\r\n   if (chess[m][n] == 0) {\r\n    \/\/ m\u4ee3\u8868X\u5750\u6807\uff0cn\u4ee3\u8868Y\u5750\u6807,1:\u9ed1\u5b50\uff1b2:\u767d\u5b50\r\n    count = 2; \/\/ \u753b\u767d\u5b50\r\n    draw_chess = true;\r\n    chess[m][n] = 2;\r\n    winner = Traversal_chessboard(); \/\/ \u68c0\u67e5\u662f\u5426\u6709\u83b7\u80dc\u7684\u73a9\u5bb6\r\n    AI_play = true;\r\n   } else {\r\n    draw_chess = false;\r\n   }\r\n  }\r\n\r\n  this.repaint();\r\n }\r\n\r\n void AI_play() {\r\n  int[] AI_coord = new int[2];\r\n  AI_coord = computer.play(chess);\r\n  count = 1; \/\/ \u753b\u9ed1\u5b50\r\n  x = 100 + 26 * AI_coord[0];\r\n  y = 100 + 26 * AI_coord[1];\r\n  chess[AI_coord[0]][AI_coord[1]] = 1;\r\n  winner = Traversal_chessboard(); \/\/ \u68c0\u67e5\u662f\u5426\u6709\u83b7\u80dc\u7684\u73a9\u5bb6\r\n }\r\n\r\n \/\/ \u904d\u5386\u68cb\u76d8\u4e0a\u7684\u6240\u6709\u68cb\u5b50\r\n int Traversal_chessboard() {\r\n  for (int i = 0; i &lt; 23; i++) {\r\n   for (int j = 0; j &lt; 23; j++) {\r\n    if (chess[i][j] != 0) {\r\n     if (judgement_win(i, j)) \/\/ \u4ee5\u67d0\u4e00\u68cb\u5b50\u4e3a\u4e2d\u5fc3\u68c0\u67e5\u662f\u5426\u8fde\u591f\u4e94\u4e2a\r\n      return chess[i][j];\r\n    }\r\n   }\r\n  }\r\n  return 0;\r\n }\r\n\r\n \/\/ \u5224\u65ad\u5f53\u524d\u989c\u8272\u7684\u68cb\u5b50\u662f\u5426\u80dc\u5229.\u3002\r\n \/\/ \u4f20\u5165\u68cb\u5b50\u7684X,Y\u5750\u6807\r\n boolean judgement_win(int chess_x, int chess_y) {\r\n  boolean win = false;\r\n  int last_chess = chess[chess_x][chess_y];\r\n  int x_t = 0, y_t = 0;\r\n\r\n  \/\/ \u5206\u522b\u68c0\u67e5\u516b\u4e2a\u65b9\u5411\r\n  for (int i = 0; i &lt; 8;) {\r\n   switch (i) {\r\n   case 0:\r\n    x_t++;\r\n    break;\r\n   case 1:\r\n    x_t++;\r\n    y_t++;\r\n    break;\r\n   case 2:\r\n    y_t++;\r\n    break;\r\n   case 3:\r\n    x_t--;\r\n    y_t++;\r\n    break;\r\n   case 4:\r\n    x_t--;\r\n    break;\r\n   case 5:\r\n    y_t--;\r\n    x_t--;\r\n    break;\r\n   case 6:\r\n    y_t--;\r\n    break;\r\n   case 7:\r\n    y_t--;\r\n    x_t++;\r\n    break;\r\n   }\r\n\r\n   try {\r\n    if (chess[chess_x + x_t][chess_y + y_t] != last_chess) {\r\n     i++;\r\n     y_t = x_t = 0;\r\n     win = false;\r\n     continue;\r\n    } else {\r\n     win = true;\r\n    }\r\n   } catch (Exception e) {\r\n    i++;\r\n    y_t = x_t = 0;\r\n    win = false;\r\n   }\r\n   if (Math.abs(x_t) == 4 || Math.abs(y_t) == 4) {\r\n    if (win)\r\n     return true;\r\n    y_t = x_t = 0;\r\n    i++;\r\n   }\r\n  }\r\n  return false;\r\n }\r\n\r\n @Override\r\n public void mouseEntered(MouseEvent arg0) {\r\n  \/\/ TODO Auto-generated method stub\r\n\r\n }\r\n\r\n @Override\r\n public void mouseExited(MouseEvent arg0) {\r\n  \/\/ TODO Auto-generated method stub\r\n\r\n }\r\n\r\n @Override\r\n public void mousePressed(MouseEvent arg0) {\r\n  \/\/ TODO Auto-generated method stub\r\n\r\n }\r\n\r\n @Override\r\n public void mouseReleased(MouseEvent arg0) {\r\n  \/\/ TODO Auto-generated method stub\r\n\r\n }\r\n\r\n public static void main(String args[]) {\r\n\r\n  \/\/ TODO: handle exception\r\n\r\n  Main start = new Main();\/\/ \u6267\u884c\u6784\u9020\u51fd\u6570\r\n }\r\n}\r\n\r\n \r\n\r\n \r\n\r\n=====================AI.java============================\r\n\r\nimport java.util.Random;\r\n\r\npublic class AI {\r\n static int Traversal_x = 0, Traversal_y = 0;\r\n int Intercept_status;\r\n int[][] chessboard = new int[23][23];\r\n int[] Best_direct = new int[4];\r\n Random rand = new Random();\r\n\r\n \/\/ \u4f20\u5165\u68cb\u76d8\u5e03\u5c40\u7684\u4e8c\u7ef4\u6570\u7ec4\uff0c\u8fd4\u56de\u8ba1\u7b97\u673a\u843d\u5b50\u7684\u5750\u6807\uff0c\u9996\u5143\u7d20\u4e3aX\uff0c\u672b\u5143\u7d20\u4e3aY\u3002\r\n public int[] play(int[][] chess) {\r\n  Traversal_x = Traversal_y = 0;\r\n  int[] coord = new int[2];\r\n  int[] target_coord = new int[3]; \/\/ \u524d\u4e24\u4e2a\u5143\u7d20\u8868\u793a\u8d77\u59cb\u68cb\u5b50\u5750\u6807\uff0c\u672b\u5143\u7d20\u8868\u793a\u8fde\u7eed\u65b9\u5411\u3002\r\n  \/\/ Traversal_x=Traversal_y=0;\r\n  System.arraycopy(chess, 0, chessboard, 0, chess.length); \/\/ \u590d\u5236\u6570\u7ec4\r\n\r\n  \/\/ \u9996\u5148\u68c0\u67e5\u9ed1\u68cb\u662f\u5426\u6709\u8fde\u591f4\u4e2a\u7684\u60c5\u51b5\u3002\r\n  Traversal_x = Traversal_y = 0; \/\/ \u4ece\u68cb\u76d8\u5de6\u4e0a\u89d2\u5f00\u59cb\u904d\u5386\u3002\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   if ((target_coord = Traversal_chessboard(4, 1))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u9ed1\u68cb\u7684\u56f4\u5835\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    switch (Intercept_status) {\r\n    case 1: \/\/ \u9996\u90e8\u88ab\u5835\u4f4f\u4e86\uff0c\u4f46\u662f\u5c3e\u90e8\u6ca1\u6709\u88ab\u5835\u4f4f\u3002\r\n     \/\/ \u5728\u5c3e\u90e8\u6dfb\u52a0\u4e00\u68cb\u5b50\r\n     coord = block_tail(target_coord[0], target_coord[1],\r\n       target_coord[2]);\r\n     return coord;\r\n    case 2: \/\/ \u5c3e\u90e8\u88ab\u5835\u4f4f\u4e86\uff0c\u4f46\u662f\u9996\u90e8\u6ca1\u6709\u88ab\u5835\u4f4f\u3002\r\n     \/\/ \u5728\u9996\u90e8\u6dfb\u52a0\u4e00\u68cb\u5b50\r\n     coord = block_header(target_coord[0], target_coord[1],\r\n       target_coord[2]);\r\n     return coord;\r\n    case 0: \/\/ \u4e24\u8fb9\u90fd\u6ca1\u6709\u88ab\u5835\u4f4f\u3002\r\n     \/\/ \u5728\u5c3e\u90e8\u6dfb\u52a0\u4e00\u68cb\u5b50\r\n     coord = block_tail(target_coord[0], target_coord[1],\r\n       target_coord[2]);\r\n     return coord;\r\n    default: \/\/ \u4e24\u8fb9\u90fd\u88ab\u5835\u4f4f\u4e86\u3002\r\n     Traversal_x++;\r\n     break;\r\n    }\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u662f\u5426\u6709\u4e09\u9ed1\u4e00\u7a7a\u4e00\u9ed1\u7684\u60c5\u51b5\r\n  Traversal_x = Traversal_y = 0; \/\/ \u4ece\u68cb\u76d8\u5de6\u4e0a\u89d2\u91cd\u65b0\u5f00\u59cb\u904d\u5386\u3002\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   \/\/ \u9996\u5148\u53d6\u5f97\u6709\u4e09\u4e2a\u8fde\u7eed\u9ed1\u68cb\u7684\u60c5\u51b5\u3002\r\n   if ((target_coord = Traversal_chessboard(3, 1))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u9ed1\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    if (Intercept_status != 3) {\r\n     switch (sangeyi(target_coord[0], target_coord[1],\r\n       target_coord[2], Intercept_status)) {\r\n     case 1:\r\n      coord = block_tail(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     case 2:\r\n      coord = block_header(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     default:\r\n      break;\r\n     }\r\n    }\r\n    Traversal_x++;\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u662f\u5426\u6709\u4e24\u9ed1\u4e00\u7a7a\u4e24\u9ed1\u7684\u60c5\u51b5\u3002\r\n  Traversal_x = Traversal_y = 0; \/\/ \u4ece\u68cb\u76d8\u5de6\u4e0a\u89d2\u91cd\u65b0\u5f00\u59cb\u904d\u5386\u3002\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   \/\/ \u9996\u5148\u53d6\u5f97\u6709\u4e24\u4e2a\u8fde\u7eed\u9ed1\u68cb\u7684\u60c5\u51b5\u3002\r\n   if ((target_coord = Traversal_chessboard(2, 1))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u9ed1\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    if (Intercept_status != 3) {\r\n     switch (ergeyilianer(target_coord[0], target_coord[1],\r\n       target_coord[2], Intercept_status)) {\r\n     case 1:\r\n      coord = block_tail(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     case 2:\r\n      coord = block_header(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     default:\r\n      break;\r\n     }\r\n    }\r\n    Traversal_x++;\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u767d\u5b50\u662f\u5426\u6709\u8fde\u591f4\u4e2a\u7684\u60c5\u51b5\r\n  Traversal_x = Traversal_y = 0; \/\/ \u4ece\u68cb\u76d8\u5de6\u4e0a\u89d2\u91cd\u65b0\u5f00\u59cb\u904d\u5386\u3002\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   if ((target_coord = Traversal_chessboard(4, 2))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u767d\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    switch (Intercept_status) {\r\n    case 1: \/\/ \u9996\u90e8\u5835\u4f4f\u4e86\uff0c\u4f46\u662f\u5c3e\u90e8\u6ca1\u6709\u5835\u4f4f\u3002\r\n     coord = block_tail(target_coord[0], target_coord[1],\r\n       target_coord[2]);\r\n     return coord;\r\n    case 2: \/\/ \u5c3e\u90e8\u5835\u4f4f\u4e86\uff0c\u4f46\u662f\u9996\u90e8\u6ca1\u6709\u88ab\u5835\u4f4f\u3002\r\n     coord = block_header(target_coord[0], target_coord[1],\r\n       target_coord[2]);\r\n     return coord;\r\n    case 0: \/\/ \u5934\u90e8\u548c\u5c3e\u90e8\u90fd\u6ca1\u5835\u4f4f\r\n     coord = block_header(target_coord[0], target_coord[1],\r\n       target_coord[2]);\r\n     return coord;\r\n    default: \/\/ \u5934\u90e8\u548c\u5c3e\u90e8\u90fd\u88ab\u5835\u4f4f\u4e86\r\n     Traversal_x++; \/\/ \u904d\u5386\u7684\u5750\u6807\u5411X\u8f74\u6b63\u5411\u79fb\u4e00\u4f4d\u3002\r\n     break;\r\n    }\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u662f\u5426\u6709\u4e09\u767d\u4e00\u7a7a\u4e00\u767d\u7684\u60c5\u51b5\r\n  Traversal_x = Traversal_y = 0; \/\/ \u4ece\u68cb\u76d8\u5de6\u4e0a\u89d2\u91cd\u65b0\u5f00\u59cb\u904d\u5386\u3002\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   \/\/ \u9996\u5148\u53d6\u5f97\u6709\u4e09\u4e2a\u8fde\u7eed\u767d\u68cb\u7684\u60c5\u51b5\u3002\r\n   if ((target_coord = Traversal_chessboard(3, 2))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u767d\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    if (Intercept_status != 3) {\r\n     switch (sangeyi(target_coord[0], target_coord[1],\r\n       target_coord[2], Intercept_status)) {\r\n     case 1:\r\n      coord = block_tail(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     case 2:\r\n      coord = block_header(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     default:\r\n      break;\r\n     }\r\n    }\r\n    Traversal_x++;\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u662f\u5426\u6709\u4e24\u767d\u4e00\u7a7a\u4e24\u767d\u7684\u60c5\u51b5\u3002\r\n  Traversal_x = Traversal_y = 0; \/\/ \u4ece\u68cb\u76d8\u5de6\u4e0a\u89d2\u91cd\u65b0\u5f00\u59cb\u904d\u5386\u3002\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   \/\/ \u9996\u5148\u53d6\u5f97\u6709\u4e24\u4e2a\u8fde\u7eed\u9ed1\u68cb\u7684\u60c5\u51b5\u3002\r\n   if ((target_coord = Traversal_chessboard(2, 2))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u9ed1\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    if (Intercept_status != 3) {\r\n     switch (ergeyilianer(target_coord[0], target_coord[1],\r\n       target_coord[2], Intercept_status)) {\r\n     case 1:\r\n      coord = block_tail(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     case 2:\r\n      coord = block_header(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     default:\r\n      break;\r\n     }\r\n    }\r\n    Traversal_x++;\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u9ed1\u5b50\u662f\u5426\u6709\u8fde\u591f3\u4e2a\u4e14\u4e24\u8fb9\u90fd\u6ca1\u5835\u7684\u60c5\u51b5\u3002\r\n  boolean random = false;\r\n  int _x = 0, _y = 0;\r\n  Traversal_x = Traversal_y = 0;\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   if ((target_coord = Traversal_chessboard(3, 1))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u9ed1\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    switch (Intercept_status) {\r\n    case 0: \/\/ \u5934\u90e8\u548c\u5c3e\u90e8\u90fd\u6ca1\u5835\u4f4f\r\n     switch (target_coord[2]) {\r\n     case 0:\r\n      _x = 4;\r\n      break;\r\n     case 1:\r\n      _x = 4;\r\n      _y = 4;\r\n      break;\r\n     case 2:\r\n      _y = 4;\r\n      break;\r\n     case 3:\r\n      _y = 4;\r\n      _x = -4;\r\n      break;\r\n     case 4:\r\n      _x = -4;\r\n      break;\r\n     case 5:\r\n      _x = -4;\r\n      _y = -4;\r\n      break;\r\n     case 6:\r\n      _y = -4;\r\n      break;\r\n     case 7:\r\n      _y = -4;\r\n      _x = 4;\r\n      break;\r\n     }\r\n     try { \/\/ \u8bd5\u63a2\u5c3e\u68cb\u5b50\u53ef\u5426\u518d\u589e\u52a0\r\n      if (chessboard[target_coord[0] + _x][target_coord[1]\r\n        + _y] != 2) {\r\n       \/\/ \u5c3e\u68cb\u5b50\u53ef\u518d\u589e\u52a0\r\n       switch (target_coord[2]) {\r\n       case 0:\r\n        _x = -2;\r\n        break;\r\n       case 1:\r\n        _x = -2;\r\n        _y = -2;\r\n        break;\r\n       case 2:\r\n        _y = -2;\r\n        break;\r\n       case 3:\r\n        _y = -2;\r\n        _x = 2;\r\n        break;\r\n       case 4:\r\n        _x = 2;\r\n        break;\r\n       case 5:\r\n        _x = 2;\r\n        _y = 2;\r\n        break;\r\n       case 6:\r\n        _y = 2;\r\n        break;\r\n       case 7:\r\n        _y = 2;\r\n        _x = -2;\r\n        break;\r\n       }\r\n       try { \/\/ \u8bd5\u63a2\u9996\u68cb\u5b50\u662f\u5426\u53ef\u518d\u589e\u52a0\r\n        if (chessboard[target_coord[0] + _x][target_coord[1]\r\n          + _y] != 2) {\r\n         \/\/ \u9996\u68cb\u5b50\u4e5f\u53ef\u7ee7\u7eed\u589e\u52a0\r\n         random = true; \/\/ \u53ef\u968f\u673a\u9009\u62e9\u589e\u52a0\u4f4d\u7f6e\r\n        } else {\r\n         \/\/ \u9996\u68cb\u5b50\u4e0d\u53ef\u518d\u589e\u52a0\uff0c\u53ea\u80fd\u589e\u52a0\u5230\u5c3e\u68cb\u5b50\u5904\r\n         coord = block_tail(target_coord[0],\r\n           target_coord[1], target_coord[2]);\r\n         return coord;\r\n        }\r\n       } catch (Exception e) {\r\n        \/\/ TODO: handle exception\r\n        coord = block_tail(target_coord[0],\r\n          target_coord[2], target_coord[2]);\r\n        return coord;\r\n       }\r\n      } else { \/\/ \u5c3e\u68cb\u5b50\u5df2\u4e0d\u53ef\u518d\u52a0\uff0c\u8bd5\u63a2\u9996\u68cb\u5b50\u53ef\u518d\u52a0\u5426\r\n       switch (target_coord[2]) {\r\n       case 0:\r\n        _x = -2;\r\n        break;\r\n       case 1:\r\n        _x = -2;\r\n        _y = -2;\r\n        break;\r\n       case 2:\r\n        _y = -2;\r\n        break;\r\n       case 3:\r\n        _y = -2;\r\n        _x = 2;\r\n        break;\r\n       case 4:\r\n        _x = 2;\r\n        break;\r\n       case 5:\r\n        _x = 2;\r\n        _y = 2;\r\n        break;\r\n       case 6:\r\n        _y = 2;\r\n        break;\r\n       case 7:\r\n        _y = 2;\r\n        _x = -2;\r\n        break;\r\n       }\r\n       try {\r\n        if (chessboard[target_coord[0] + _x][target_coord[1]\r\n          + _y] != 2) {\r\n         \/\/ \u9996\u68cb\u5b50\u53ef\u518d\u589e\u52a0\r\n         coord = block_header(target_coord[0],\r\n           target_coord[1], target_coord[2]);\r\n         return coord;\r\n        } else\r\n         break; \/\/ \u9996\u68cb\u5b50\u548c\u5c3e\u68cb\u5b50\u90fd\u4e0d\u53ef\u518d\u589e\u52a0\r\n       } catch (Exception e2) {\r\n        \/\/ TODO: handle exception\r\n        break; \/\/ \u9996\u68cb\u5b50\u548c\u5c3e\u68cb\u5b50\u90fd\u4e0d\u53ef\u518d\u589e\u52a0\r\n       }\r\n      }\r\n     } catch (Exception e) {\r\n      \/\/ \u5c3e\u68cb\u5b50\u4e0d\u53ef\u518d\u589e\u52a0\uff0c\u8bd5\u63a2\u9996\u68cb\u5b50\u662f\u5426\u53ef\u518d\u589e\u52a0\r\n      \/\/ TODO: handle exception\r\n      switch (target_coord[2]) {\r\n      case 0:\r\n       _x = -2;\r\n       break;\r\n      case 1:\r\n       _x = -2;\r\n       _y = -2;\r\n       break;\r\n      case 2:\r\n       _y = -2;\r\n       break;\r\n      case 3:\r\n       _y = -2;\r\n       _x = 2;\r\n       break;\r\n      case 4:\r\n       _x = 2;\r\n       break;\r\n      case 5:\r\n       _x = 2;\r\n       _y = 2;\r\n       break;\r\n      case 6:\r\n       _y = 2;\r\n       break;\r\n      case 7:\r\n       _y = 2;\r\n       _x = -2;\r\n       break;\r\n      }\r\n      try {\r\n       if (chessboard[target_coord[0] + _x][target_coord[1]\r\n         + _y] != 2) {\r\n        \/\/ \u9996\u68cb\u5b50\u53ef\u518d\u589e\u52a0\r\n        coord = block_header(target_coord[0],\r\n          target_coord[1], target_coord[2]);\r\n        return coord;\r\n       } else\r\n        break; \/\/ \u9996\u68cb\u5b50\u548c\u5c3e\u68cb\u5b50\u90fd\u4e0d\u53ef\u518d\u589e\u52a0\r\n      } catch (Exception e2) {\r\n       \/\/ TODO: handle exception\r\n       break; \/\/ \u9996\u68cb\u5b50\u548c\u5c3e\u68cb\u5b50\u90fd\u4e0d\u53ef\u518d\u589e\u52a0\r\n      }\r\n     }\r\n     if (random) {\r\n      if (rand.nextInt() % 2 == 0) {\r\n       coord = block_tail(target_coord[0],\r\n         target_coord[1], target_coord[2]);\r\n      } else {\r\n       coord = block_header(target_coord[0],\r\n         target_coord[1], target_coord[2]);\r\n      }\r\n      return coord;\r\n     }\r\n     break;\r\n    default:\r\n     break;\r\n    }\r\n    Traversal_x++; \/\/ \u904d\u5386\u7684\u5750\u6807\u5411X\u8f74\u6b63\u5411\u79fb\u4e00\u4f4d\u3002\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u6709\u65e0\u65ad\u5939\u89d2\u4e3a2\u65ad\u8fde\u4e09\u7684\u60c5\u51b5\r\n  if ((coord = duanjiajiao_siliansan(1))[0] != -1) {\r\n   return coord;\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u662f\u5426\u6709\u4e24\u9ed1\u4e00\u7a7a\u4e00\u9ed1\u7684\u60c5\u51b5\u3002\r\n  Traversal_x = Traversal_y = 0; \/\/ \u4ece\u68cb\u76d8\u5de6\u4e0a\u89d2\u91cd\u65b0\u5f00\u59cb\u904d\u5386\u3002\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   \/\/ \u9996\u5148\u53d6\u5f97\u6709\u4e24\u4e2a\u8fde\u7eed\u9ed1\u68cb\u7684\u60c5\u51b5\u3002\r\n   if ((target_coord = Traversal_chessboard(2, 1))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u9ed1\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    if (Intercept_status != 3) {\r\n     switch (ergeyilianyi(target_coord[0], target_coord[1],\r\n       target_coord[2], Intercept_status)) {\r\n     case 1:\r\n      coord = block_tail(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     case 2:\r\n      coord = block_header(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     default:\r\n      break;\r\n     }\r\n    }\r\n    Traversal_x++;\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u662f\u5426\u6709\u4e09\u8fde\u4e00\u8fb9\u5835\u7684\u60c5\u51b5\r\n  Traversal_x = Traversal_y = 0;\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   if ((target_coord = Traversal_chessboard(3, 1))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u9ed1\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    switch (Intercept_status) {\r\n    case 1:\r\n     if (Liansi(target_coord[0], target_coord[1],\r\n       target_coord[2], Intercept_status)) {\r\n      coord = block_tail(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     } else {\r\n      break;\r\n     }\r\n    default:\r\n     break;\r\n    }\r\n    Traversal_x++; \/\/ \u904d\u5386\u7684\u5750\u6807\u5411X\u8f74\u6b63\u5411\u79fb\u4e00\u4f4d\u3002\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u767d\u68cb\u6709\u65e0\u65ad\u5939\u89d2\u4e3a2\u65ad\u8fde\u4e09\u7684\u60c5\u51b5\r\n  if ((coord = duanjiajiao_siliansan(2))[0] != -1) {\r\n   return coord;\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u767d\u5b50\u662f\u5426\u6709\u8fde\u591f3\u4e2a\u7684\u60c5\u51b5\u3002\r\n  Traversal_x = Traversal_y = 0;\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   if ((target_coord = Traversal_chessboard(3, 2))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u767d\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    switch (Intercept_status) {\r\n    case 0: \/\/ \u8868\u793a\u8fd9\u4e32\u767d\u68cb\u6ca1\u6709\u88ab\u56f4\u5835\r\n     if (rand.nextInt() % 2 == 0) {\r\n      coord = block_header(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     } else {\r\n      coord = block_tail(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     }\r\n    default:\r\n     break;\r\n    }\r\n    Traversal_x++;\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u662f\u5426\u6709\u4e24\u767d\u4e00\u7a7a\u4e00\u767d\u7684\u60c5\u51b5\u3002\r\n  Traversal_x = Traversal_y = 0; \/\/ \u4ece\u68cb\u76d8\u5de6\u4e0a\u89d2\u91cd\u65b0\u5f00\u59cb\u904d\u5386\u3002\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   \/\/ \u9996\u5148\u53d6\u5f97\u6709\u4e24\u4e2a\u8fde\u7eed\u767d\u68cb\u7684\u60c5\u51b5\u3002\r\n   if ((target_coord = Traversal_chessboard(2, 2))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u767d\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    if (Intercept_status == 0) {\r\n     switch (ergeyilianyi(target_coord[0], target_coord[1],\r\n       target_coord[2], Intercept_status)) {\r\n     case 1:\r\n      coord = block_tail(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     case 2:\r\n      coord = block_header(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     case 0:\r\n     default:\r\n      break;\r\n     }\r\n    }\r\n    Traversal_x++;\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u662f\u9ed1\u68cb\u5426\u6709T\u5f62\u56fe\u6848\r\n  if ((coord = T_pattern(1))[0] != -1) {\r\n   return coord;\r\n  }\r\n  \/\/ \u68c0\u67e5\u9ed1\u5b50\u662f\u5426\u6709\u7a7a\u5341\u5b57\u7684\u56fe\u6848\r\n  if ((coord = Check_Cross(1))[0] != -1) {\r\n   return coord;\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u9ed1\u5b50\u662f\u5426\u6709\u65ad\u5939\u89d2\u56fe\u6848\r\n  if ((coord = duanjiajiao(1))[0] != -1) {\r\n   return coord;\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u9ed1\u68cb\u662f\u5426\u6709\u8fde\u591f2\u4e2a\u7684\u60c5\u51b5\r\n  _x = _y = 0;\r\n  random = false;\r\n  Traversal_x = Traversal_y = 0;\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   if ((target_coord = Traversal_chessboard(2, 1))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u9ed1\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    switch (Intercept_status) {\r\n    case 0: \/\/ \u8868\u793a\u8fd9\u4e32\u9ed1\u68cb\u6ca1\u6709\u88ab\u56f4\u5835\r\n     switch (target_coord[2]) {\r\n     case 0:\r\n      _x = 3;\r\n      break;\r\n     case 1:\r\n      _x = 3;\r\n      _y = 3;\r\n      break;\r\n     case 2:\r\n      _y = 3;\r\n      break;\r\n     case 3:\r\n      _y = 3;\r\n      _x = -3;\r\n      break;\r\n     case 4:\r\n      _x = -3;\r\n      break;\r\n     case 5:\r\n      _x = -3;\r\n      _y = -3;\r\n      break;\r\n     case 6:\r\n      _y = -3;\r\n      break;\r\n     case 7:\r\n      _y = -3;\r\n      _x = 3;\r\n      break;\r\n     }\r\n     try { \/\/ \u8bd5\u63a2\u5c3e\u68cb\u5b50\u53ef\u5426\u518d\u589e\u52a0\r\n      if (chessboard[target_coord[0] + _x][target_coord[1]\r\n        + _y] != 2) {\r\n       \/\/ \u5c3e\u68cb\u5b50\u53ef\u518d\u589e\u52a0\r\n       switch (target_coord[2]) {\r\n       case 0:\r\n        _x = -2;\r\n        break;\r\n       case 1:\r\n        _x = -2;\r\n        _y = -2;\r\n        break;\r\n       case 2:\r\n        _y = -2;\r\n        break;\r\n       case 3:\r\n        _y = -2;\r\n        _x = 2;\r\n        break;\r\n       case 4:\r\n        _x = 2;\r\n        break;\r\n       case 5:\r\n        _x = 2;\r\n        _y = 2;\r\n        break;\r\n       case 6:\r\n        _y = 2;\r\n        break;\r\n       case 7:\r\n        _y = 2;\r\n        _x = -2;\r\n        break;\r\n       }\r\n       try { \/\/ \u8bd5\u63a2\u9996\u68cb\u5b50\u662f\u5426\u53ef\u518d\u589e\u52a0\r\n        if (chessboard[target_coord[0] + _x][target_coord[1]\r\n          + _y] != 2) {\r\n         \/\/ \u9996\u68cb\u5b50\u4e5f\u53ef\u7ee7\u7eed\u589e\u52a0\r\n         random = true; \/\/ \u53ef\u968f\u673a\u9009\u62e9\u589e\u52a0\u4f4d\u7f6e\r\n         break;\r\n        } else {\r\n         \/\/ \u9996\u68cb\u5b50\u4e0d\u53ef\u518d\u589e\u52a0\uff0c\u53ea\u80fd\u589e\u52a0\u5230\u5c3e\u68cb\u5b50\u5904\r\n         coord = block_tail(target_coord[0],\r\n           target_coord[1], target_coord[2]);\r\n         return coord;\r\n        }\r\n       } catch (Exception e) {\r\n        \/\/ TODO: handle exception\r\n        coord = block_tail(target_coord[0],\r\n          target_coord[2], target_coord[2]);\r\n        return coord;\r\n       }\r\n      } else { \/\/ \u5c3e\u68cb\u5b50\u5df2\u4e0d\u53ef\u518d\u52a0\uff0c\u8bd5\u63a2\u9996\u68cb\u5b50\u53ef\u518d\u52a0\u5426\r\n       switch (target_coord[2]) {\r\n       case 0:\r\n        _x = -2;\r\n        break;\r\n       case 1:\r\n        _x = -2;\r\n        _y = -2;\r\n        break;\r\n       case 2:\r\n        _y = -2;\r\n        break;\r\n       case 3:\r\n        _y = -2;\r\n        _x = 2;\r\n        break;\r\n       case 4:\r\n        _x = 2;\r\n        break;\r\n       case 5:\r\n        _x = 2;\r\n        _y = 2;\r\n        break;\r\n       case 6:\r\n        _y = 2;\r\n        break;\r\n       case 7:\r\n        _y = 2;\r\n        _x = -2;\r\n        break;\r\n       }\r\n       try {\r\n        if (chessboard[target_coord[0] + _x][target_coord[1]\r\n          + _y] != 2) {\r\n         \/\/ \u9996\u68cb\u5b50\u53ef\u518d\u589e\u52a0\r\n         coord = block_header(target_coord[0],\r\n           target_coord[1], target_coord[2]);\r\n         return coord;\r\n        } else\r\n         break; \/\/ \u9996\u68cb\u5b50\u548c\u5c3e\u68cb\u5b50\u90fd\u4e0d\u53ef\u518d\u589e\u52a0\r\n       } catch (Exception e2) {\r\n        \/\/ TODO: handle exception\r\n        break; \/\/ \u9996\u68cb\u5b50\u548c\u5c3e\u68cb\u5b50\u90fd\u4e0d\u53ef\u518d\u589e\u52a0\r\n       }\r\n      }\r\n     } catch (Exception e) {\r\n      \/\/ \u5c3e\u68cb\u5b50\u4e0d\u53ef\u518d\u589e\u52a0\uff0c\u8bd5\u63a2\u9996\u68cb\u5b50\u662f\u5426\u53ef\u518d\u589e\u52a0\r\n      \/\/ TODO: handle exception\r\n      switch (target_coord[2]) {\r\n      case 0:\r\n       _x = -2;\r\n       break;\r\n      case 1:\r\n       _x = -2;\r\n       _y = -2;\r\n       break;\r\n      case 2:\r\n       _y = -2;\r\n       break;\r\n      case 3:\r\n       _y = -2;\r\n       _x = 2;\r\n       break;\r\n      case 4:\r\n       _x = 2;\r\n       break;\r\n      case 5:\r\n       _x = 2;\r\n       _y = 2;\r\n       break;\r\n      case 6:\r\n       _y = 2;\r\n       break;\r\n      case 7:\r\n       _y = 2;\r\n       _x = -2;\r\n       break;\r\n      }\r\n      try {\r\n       if (chessboard[target_coord[0] + _x][target_coord[1]\r\n         + _y] != 2) {\r\n        \/\/ \u9996\u68cb\u5b50\u53ef\u518d\u589e\u52a0\r\n        coord = block_header(target_coord[0],\r\n          target_coord[1], target_coord[2]);\r\n        return coord;\r\n       } else\r\n        break; \/\/ \u9996\u68cb\u5b50\u548c\u5c3e\u68cb\u5b50\u90fd\u4e0d\u53ef\u518d\u589e\u52a0\r\n      } catch (Exception e2) {\r\n       \/\/ TODO: handle exception\r\n       break; \/\/ \u9996\u68cb\u5b50\u548c\u5c3e\u68cb\u5b50\u90fd\u4e0d\u53ef\u518d\u589e\u52a0\r\n      }\r\n     }\r\n    default:\r\n     break;\r\n    }\r\n    if (random)\r\n     if (rand.nextInt() % 2 == 0) {\r\n      coord = block_header(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     } else {\r\n      coord = block_tail(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     }\r\n    Traversal_x++;\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u662f\u767d\u68cb\u5426\u6709T\u5f62\u56fe\u6848\r\n  if ((coord = T_pattern(2))[0] != -1) {\r\n   return coord;\r\n  }\r\n  \/\/ \u68c0\u67e5\u767d\u5b50\u662f\u5426\u6709\u7a7a\u5341\u5b57\u7684\u56fe\u6848\r\n  if ((coord = Check_Cross(2))[0] != -1) {\r\n   return coord;\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u767d\u5b50\u662f\u5426\u6709\u65ad\u5939\u89d2\u56fe\u6848\r\n  if ((coord = duanjiajiao(2))[0] != -1) {\r\n   return coord;\r\n  }\r\n\r\n  \/\/ \u627e\u51fa\u4e00\u9ed1\u9694\u4e00\u9ed1\u7684\u60c5\u51b5\r\n  if ((coord = yigeyi(1))[0] != -1) {\r\n   return coord;\r\n  }\r\n\r\n  \/\/ \u627e\u51fa\u6700\u597d\u4f4d\u7f6e\u7684\u5355\u72ec\u9ed1\u68cb\r\n  int direction = 0;\r\n  boolean skip = false;\r\n  boolean draw_chess = false;\r\n  Traversal_x = Traversal_y = 0;\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   if ((target_coord = Traversal_chessboard(1, 1))[0] != -1) {\r\n    Best_direct = Best_Position(target_coord[0], target_coord[1]);\r\n    for (int i = 0; i &lt; Best_direct.length; i++) {\r\n    }\r\n    skip = false;\r\n    draw_chess = true;\r\n    if (rand.nextInt() % 2 == 0) {\r\n     if (Best_direct[0] == 8 &amp;&amp; Best_direct[1] == 8) {\r\n      if (rand.nextInt() % 2 == 0)\r\n       direction = 1;\r\n      else {\r\n       direction = 3;\r\n      }\r\n     } else {\r\n      if (Best_direct[0] == 8)\r\n       direction = 1;\r\n      else if (Best_direct[1] == 8)\r\n       direction = 3;\r\n      else {\r\n       skip = true;\r\n      }\r\n     }\r\n    } else {\r\n     if (Best_direct[2] == 8 &amp;&amp; Best_direct[3] == 8) {\r\n      if (rand.nextInt() % 2 == 0)\r\n       direction = 2;\r\n      else {\r\n       direction = 0;\r\n      }\r\n     } else {\r\n      if (Best_direct[2] == 8)\r\n       direction = 2;\r\n      else if (Best_direct[3] == 8)\r\n       direction = 0;\r\n      else {\r\n       draw_chess = false;\r\n      }\r\n     }\r\n    }\r\n    if (skip) {\r\n     if (Best_direct[2] == 8 &amp;&amp; Best_direct[3] == 8) {\r\n      if (rand.nextInt() % 2 == 0)\r\n       direction = 2;\r\n      else {\r\n       direction = 0;\r\n      }\r\n     } else {\r\n      if (Best_direct[2] == 8)\r\n       direction = 2;\r\n      else if (Best_direct[3] == 8)\r\n       direction = 0;\r\n      else {\r\n       draw_chess = false;\r\n      }\r\n     }\r\n    }\r\n    if (draw_chess) {\r\n     if (rand.nextInt() % 2 == 0)\r\n      coord = block_header(target_coord[0], target_coord[1],\r\n        direction);\r\n     else {\r\n      coord = block_tail(target_coord[0], target_coord[1],\r\n        direction);\r\n     }\r\n     return coord;\r\n    }\r\n    Traversal_x++;\r\n   }\r\n  }\r\n\r\n  \/\/ \u627e\u51fa\u4e00\u767d\u9694\u4e00\u767d\u7684\u60c5\u51b5\r\n  if ((coord = yigeyi(2))[0] != -1) {\r\n   return coord;\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u767d\u68cb\u662f\u5426\u6709\u8fde\u591f2\u4e2a\u7684\u60c5\u51b5\r\n  Traversal_x = Traversal_y = 0;\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   if ((target_coord = Traversal_chessboard(2, 2))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u767d\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    switch (Intercept_status) {\r\n    case 0: \/\/ \u8868\u793a\u8fd9\u4e32\u767d\u68cb\u6ca1\u6709\u88ab\u56f4\u5835\r\n     if (rand.nextInt() % 2 == 0) {\r\n      coord = block_header(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     } else {\r\n      coord = block_tail(target_coord[0], target_coord[1],\r\n        target_coord[2]);\r\n      return coord;\r\n     }\r\n    default:\r\n     break;\r\n    }\r\n    Traversal_x++;\r\n   }\r\n  }\r\n\r\n  \/\/ \u68c0\u67e5\u9ed1\u68cb\u662f\u5426\u6709\u8fde\u591f2\u4e2a\u7684\u60c5\u51b5(\u4e00\u9762\u88ab\u5835\uff0c\u4e00\u9762\u5f00\u653e)\r\n  Traversal_x = Traversal_y = 0;\r\n  while (Traversal_x != 22 || Traversal_y != 22) {\r\n   if ((target_coord = Traversal_chessboard(2, 1))[0] != -1) {\r\n    \/\/ \u53d6\u5f97\u8fd9\u4e32\u9ed1\u68cb\u5b50\u56f4\u5835\u7684\u60c5\u51b5\r\n    Intercept_status = Check_Intercept(target_coord[0],\r\n      target_coord[1], target_coord[2]);\r\n    switch (Intercept_status) {\r\n    case 1: \/\/ \u9996\u68cb\u5b50\u88ab\u5835\r\n     if (Liansan(target_coord[0], target_coord[1],\r\n       target_coord[2])) {\r\n      coord[0] = target_coord[0];\r\n      coord[1] = target_coord[1];\r\n      return coord;\r\n     }\r\n    default:\r\n     break;\r\n    }\r\n    Traversal_x++;\r\n   }\r\n  }\r\n\r\n  \/\/ \u5df2\u7ecf\u6ca1\u68cb\u53ef\u4e0b\u4e86\r\n  coord = irregular();\r\n  return coord;\r\n }\r\n\r\n \/\/ \u904d\u5386\u68cb\u76d8\r\n int[] Traversal_chessboard(int series, int player) {\r\n  int[] target_coord = new int[3]; \/\/ \u524d\u4e24\u4f4d\u8868\u793a\u9996\u68cb\u5b50\u5750\u6807\uff0c\u672b\u4f4d\u8868\u793a\u8fde\u7eed\u65b9\u5411\u3002\r\n  target_coord[0] = target_coord[1] = -1;\r\n  for (; Traversal_y &lt; 23; Traversal_y++) {\r\n   for (; Traversal_x &lt; 23; Traversal_x++) {\r\n    if (chessboard[Traversal_x][Traversal_y] == player) {\r\n     if (series &lt;= 1) {\r\n      target_coord[0] = Traversal_x;\r\n      target_coord[1] = Traversal_y;\r\n      return target_coord;\r\n     }\r\n     if ((target_coord[2] = judgement(Traversal_x, Traversal_y,\r\n       series)) != -1) { \/\/ \u4ee5\u67d0\u4e00\u68cb\u5b50\u4e3a\u4e2d\u5fc3\u68c0\u67e5\u662f\u5426\u8fde\u591f\u53d8\u91cfseries\u4e2a\r\n      target_coord[0] = Traversal_x;\r\n      target_coord[1] = Traversal_y;\r\n      return target_coord;\r\n     }\r\n    }\r\n    if (Traversal_x == 22 &amp;&amp; Traversal_y == 22)\r\n     return target_coord;\r\n   }\r\n   Traversal_x = 0;\r\n  }\r\n  return target_coord;\r\n }\r\n\r\n \/\/ \u4f20\u5165\u68cb\u5b50\u7684\u5750\u6807\u548c\u9700\u8981\u68c0\u67e5\u7684\u957f\u5ea6,\u8fd4\u56de\u503c\u82e5\u4e0d\u4e3a-1\u5219\u8868\u660e\u8fd4\u56de\u7684\u662f\u8fde\u7eed\u65b9\u5411\u3002\r\n int judgement(int chess_x, int chess_y, int series) {\r\n  boolean status = false;\r\n  int player = chessboard[chess_x][chess_y];\r\n  int x_t = 0, y_t = 0;\r\n\r\n  \/\/ \u5206\u522b\u68c0\u67e5\u516b\u4e2a\u65b9\u5411\r\n  for (int direct = 0; direct &lt; 8;) {\r\n   switch (direct) {\r\n   case 0:\r\n    x_t++;\r\n    break;\r\n   case 1:\r\n    x_t++;\r\n    y_t++;\r\n    break;\r\n   case 2:\r\n    y_t++;\r\n    break;\r\n   case 3:\r\n    x_t--;\r\n    y_t++;\r\n    break;\r\n   case 4:\r\n    x_t--;\r\n    break;\r\n   case 5:\r\n    y_t--;\r\n    x_t--;\r\n    break;\r\n   case 6:\r\n    y_t--;\r\n    break;\r\n   case 7:\r\n    y_t--;\r\n    x_t++;\r\n    break;\r\n   }\r\n\r\n   try {\r\n    if (chessboard[chess_x + x_t][chess_y + y_t] != player) {\r\n     direct++;\r\n     y_t = x_t = 0;\r\n     status = false;\r\n     continue;\r\n    } else {\r\n     status = true;\r\n    }\r\n   } catch (Exception e) {\r\n    direct++;\r\n    y_t = x_t = 0;\r\n    status = false;\r\n    continue;\r\n   }\r\n   if (Math.abs(x_t) == (series - 1) || Math.abs(y_t) == (series - 1)) {\r\n    if (status)\r\n     return direct;\r\n    y_t = x_t = 0;\r\n    direct++;\r\n   }\r\n  }\r\n  return -1;\r\n }\r\n\r\n \/\/ \u68c0\u67e5\u8fd9\u4e32\u68cb\u5b50\u662f\u5426\u88ab\u5835\u4e0a\u4e86,\u4f20\u5165\u9996\u68cb\u5b50\u7684\u5750\u6807\u548c\u68c0\u67e5\u65b9\u5411\u3002\r\n \/\/ \u8fd4\u56de\u503c\uff1a0:\u4e24\u8fb9\u90fd\u6ca1\u5835\u4e0a.1,\u53ea\u6709\u9996\u68cb\u5b50\u5835\u4e0a\u4e86,2:\u53ea\u6709\u5c3e\u68cb\u5b50\u5835\u4e0a\u4e86\u30023\uff1a\u4e24\u8fb9\u5168\u5835\u4e0a\u4e86\u3002\r\n int Check_Intercept(int x, int y, int direct) {\r\n  int player = chessboard[x][y]; \/\/ \u83b7\u53d6\u5f53\u671f\u68cb\u5b50\u7684\u73a9\u5bb6\r\n  int _x = 0, _y = 0;\r\n  boolean header = false, tail = false;\r\n\r\n  switch (direct) {\r\n  case 0:\r\n   _x = -1;\r\n   break;\r\n  case 1:\r\n   _x = -1;\r\n   _y = -1;\r\n   break;\r\n  case 2:\r\n   _y = -1;\r\n   break;\r\n  case 3:\r\n   _x = 1;\r\n   _y = -1;\r\n   break;\r\n  case 4:\r\n   _x = 1;\r\n   break;\r\n  case 5:\r\n   _x = 1;\r\n   _y = 1;\r\n   break;\r\n  case 6:\r\n   _y = 1;\r\n   break;\r\n  case 7:\r\n   _y = 1;\r\n   _x = -1;\r\n   break;\r\n  }\r\n  try {\r\n   if (chessboard[x + _x][y + _y] != 0) {\r\n    header = false;\r\n   } else {\r\n    header = true;\r\n   }\r\n  } catch (Exception e) {\r\n   \/\/ TODO: handle exception\r\n   header = false;\r\n  }\r\n  while (true) {\r\n   switch (direct) {\r\n   case 0:\r\n    _x++;\r\n    break;\r\n   case 1:\r\n    _x++;\r\n    _y++;\r\n    break;\r\n   case 2:\r\n    _y++;\r\n    break;\r\n   case 3:\r\n    _y++;\r\n    _x--;\r\n    break;\r\n   case 4:\r\n    _x--;\r\n    break;\r\n   case 5:\r\n    _x--;\r\n    _y--;\r\n    break;\r\n   case 6:\r\n    _y--;\r\n    break;\r\n   case 7:\r\n    _x++;\r\n    _y--;\r\n    break;\r\n   }\r\n   try {\r\n    if (chessboard[x + _x][y + _y] == player)\r\n     continue;\r\n    else if (chessboard[x + _x][y + _y] == 0) {\r\n     tail = true;\r\n     break;\r\n    } else {\r\n     tail = false;\r\n     break;\r\n    }\r\n   } catch (Exception e) {\r\n    \/\/ TODO: handle exception\r\n    tail = false;\r\n    break;\r\n   }\r\n  }\r\n  if (header &amp;&amp; tail)\r\n   return 0;\r\n  else if (header)\r\n   return 2;\r\n  else if (tail)\r\n   return 1;\r\n  else {\r\n   return 3;\r\n  }\r\n }\r\n\r\n \/\/ \u56f4\u5835\u5c3e\u90e8\uff0c\u4f20\u5165\u9996\u90e8\u5750\u6807\u548c\u65b9\u5411\uff0c\u8fd4\u56de\u843d\u5b50\u5750\u6807\r\n int[] block_tail(int head_x, int head_y, int direct) {\r\n  int[] coord = new int[2];\r\n  int _x = 0, _y = 0;\r\n  while (true) {\r\n   switch (direct) {\r\n   case 0:\r\n    _x++;\r\n    break;\r\n   case 1:\r\n    _x++;\r\n    _y++;\r\n    break;\r\n   case 2:\r\n    _y++;\r\n    break;\r\n   case 3:\r\n    _y++;\r\n    _x--;\r\n    break;\r\n   case 4:\r\n    _x--;\r\n    break;\r\n   case 5:\r\n    _y--;\r\n    _x--;\r\n    break;\r\n   case 6:\r\n    _y--;\r\n    break;\r\n   case 7:\r\n    _x++;\r\n    _y--;\r\n    break;\r\n   }\r\n   try {\r\n    if (chessboard[head_x + _x][head_y + _y] == 0) {\r\n     coord[0] = head_x + _x;\r\n     coord[1] = head_y + _y;\r\n     return coord;\r\n    }\r\n   } catch (Exception e) {\r\n    coord[0] = coord[1] = -1;\r\n    break;\r\n   }\r\n  }\r\n  return coord;\r\n }\r\n\r\n \/\/ \u56f4\u5835\u5934\u90e8\uff0c\u4f20\u5165\u9996\u90e8\u5750\u6807\u548c\u65b9\u5411\uff0c\u8fd4\u56de\u843d\u5b50\u5750\u6807\r\n int[] block_header(int head_x, int head_y, int direct) {\r\n  int[] coord = new int[2];\r\n  int _x = 0, _y = 0;\r\n  switch (direct) {\r\n  case 0:\r\n   _x--;\r\n   break;\r\n  case 1:\r\n   _x--;\r\n   _y--;\r\n   break;\r\n  case 2:\r\n   _y--;\r\n   break;\r\n  case 3:\r\n   _y--;\r\n   _x++;\r\n   break;\r\n  case 4:\r\n   _x++;\r\n   break;\r\n  case 5:\r\n   _y++;\r\n   _x++;\r\n   break;\r\n  case 6:\r\n   _y++;\r\n   break;\r\n  case 7:\r\n   _x--;\r\n   _y++;\r\n   break;\r\n  }\r\n  coord[0] = head_x + _x;\r\n  coord[1] = head_y + _y;\r\n  return coord;\r\n }\r\n\r\n int[] Best_Position(int x, int y) {\r\n  \/\/ \u65b9\u54111\uff1a\u5de6\u4e0a-\u53f3\u4e0b\uff1b\u65b9\u54112\uff1a\u53f3\u4e0a-\u5de6\u4e0b\uff1b\u65b9\u54113\uff1a\u4e0a\u4e0b\uff1b\u65b9\u54114\uff1a\u5de6\u53f3\u3002\r\n  int[] status = new int[4];\r\n  try {\r\n   int _x = 0, _y = 0;\r\n   for (_x = 1, _y = 1; _x &lt;= 4; _x++, _y++) {\r\n    if (chessboard[x + _x][y + _y] == 0)\r\n     ;\r\n    else {\r\n     status[0] = _x - 1;\r\n     break;\r\n    }\r\n    if (_x == 4) {\r\n     status[0] = _x;\r\n     break;\r\n    }\r\n   }\r\n   for (_x = -1, _y = -1; _x &gt;= -4; _x--, _y--) {\r\n    if (chessboard[x + _x][y + _y] == 0)\r\n     ;\r\n    else {\r\n     status[0] += Math.abs(_x + 1);\r\n     break;\r\n    }\r\n    if (Math.abs(_x) == 4) {\r\n     status[0] += 4;\r\n     break;\r\n    }\r\n   }\r\n\r\n   for (_x = -1, _y = 1; _y &lt;= 4; _x--, _y++) {\r\n    if (chessboard[x + _x][y + _y] == 0)\r\n     ;\r\n    else {\r\n     status[1] = _y - 1;\r\n     break;\r\n    }\r\n    if (_y == 4) {\r\n     status[1] = _y;\r\n     break;\r\n    }\r\n   }\r\n   for (_x = 1, _y = -1; _x &lt;= 4; _x++, _y--) {\r\n    if (chessboard[x + _x][y + _y] == 0)\r\n     ;\r\n    else {\r\n     status[1] += Math.abs(_x - 1);\r\n     break;\r\n    }\r\n    if (Math.abs(_x) == 4) {\r\n     status[1] += 4;\r\n     break;\r\n    }\r\n   }\r\n\r\n   for (_y = 1, _x = 0; _y &lt;= 4; _y++) {\r\n    if (chessboard[x + _x][y + _y] == 0)\r\n     ;\r\n    else {\r\n     status[2] = _y - 1;\r\n     break;\r\n    }\r\n    if (_y == 4) {\r\n     status[2] = _y;\r\n     break;\r\n    }\r\n   }\r\n   for (_x = 0, _y = -1; _y &gt;= -4; _y--) {\r\n    if (chessboard[x + _x][y + _y] == 0)\r\n     ;\r\n    else {\r\n     status[2] += Math.abs(_y + 1);\r\n     break;\r\n    }\r\n    if (Math.abs(_y) == 4) {\r\n     status[2] += 4;\r\n     break;\r\n    }\r\n   }\r\n\r\n   for (_y = 0, _x = 1; _x &lt;= 4; _x++) {\r\n    if (chessboard[x + _x][y + _y] == 0)\r\n     ;\r\n    else {\r\n     status[3] = _x - 1;\r\n     break;\r\n    }\r\n    if (_x == 4) {\r\n     status[3] = _x;\r\n     break;\r\n    }\r\n   }\r\n   for (_x = -1, _y = 0; _x &gt;= -4; _x--) {\r\n    if (chessboard[x + _x][y + _y] == 0)\r\n     ;\r\n    else {\r\n     status[3] += Math.abs(_x + 1);\r\n     break;\r\n    }\r\n    if (Math.abs(_x) == 4) {\r\n     status[3] += 4;\r\n     break;\r\n    }\r\n   }\r\n   return status;\r\n  } catch (Exception e) {\r\n   \/\/ TODO: handle exception\r\n   status[0] = status[1] = status[2] = status[3] = -1;\r\n   return status;\r\n  }\r\n }\r\n\r\n int sangeyi(int x, int y, int direct, int Intercept) {\r\n  int player = chessboard[x][y];\r\n  boolean loop = false;\r\n  if (Intercept == 0) {\r\n   Intercept = 1;\r\n   loop = true;\r\n  }\r\n\r\n  int _x = 0, _y = 0;\r\n  if (Intercept == 1) { \/\/ \u9996\u68cb\u5b50\u88ab\u5835\uff0c\u5c3e\u68cb\u5b50\u6ca1\u6709\u88ab\u5835\r\n   switch (direct) {\r\n   case 0:\r\n    _x = 4;\r\n    break;\r\n   case 1:\r\n    _x = _y = 4;\r\n    break;\r\n   case 2:\r\n    _y = 4;\r\n    break;\r\n   case 3:\r\n    _x = -4;\r\n    _y = 4;\r\n    break;\r\n   case 4:\r\n    _x = -4;\r\n    break;\r\n   case 5:\r\n    _x = _y = -4;\r\n    break;\r\n   case 6:\r\n    _y = -4;\r\n    break;\r\n   case 7:\r\n    _x = 4;\r\n    _y = -4;\r\n    break;\r\n   }\r\n   try {\r\n    if (chessboard[x + _x][y + _y] == player) {\r\n     return Intercept;\r\n    } else {\r\n     if (loop) {\r\n      Intercept = 2;\r\n      loop = false;\r\n     }\r\n    }\r\n\r\n   } catch (Exception e) {\r\n    \/\/ TODO: handle exception\r\n    if (loop) {\r\n     Intercept = 2;\r\n     loop = false;\r\n    }\r\n   }\r\n\r\n   if (Intercept == 2) { \/\/ \u5c3e\u68cb\u5b50\u88ab\u5835\uff0c\u9996\u68cb\u5b50\u6ca1\u6709\u88ab\u5835\r\n    switch (direct) {\r\n    case 0:\r\n     _x = -2;\r\n     break;\r\n    case 1:\r\n     _x = _y = -2;\r\n     break;\r\n    case 2:\r\n     _y = -2;\r\n     break;\r\n    case 3:\r\n     _x = 2;\r\n     _y = -2;\r\n     break;\r\n    case 4:\r\n     _x = 2;\r\n     break;\r\n    case 5:\r\n     _x = _y = 2;\r\n     break;\r\n    case 6:\r\n     _y = 2;\r\n     break;\r\n    case 7:\r\n     _x = -2;\r\n     _y = 2;\r\n     break;\r\n    }\r\n    try {\r\n     if (chessboard[x + _x][y + _y] == player) {\r\n      return Intercept;\r\n     } else {\r\n      return -1;\r\n     }\r\n\r\n    } catch (Exception e) {\r\n     \/\/ TODO: handle exception\r\n     return -1;\r\n    }\r\n   }\r\n   if (loop) {\r\n    Intercept = 2;\r\n    if (sangeyi(x, y, direct, Intercept) != -1)\r\n     return Intercept;\r\n   }\r\n   return -1;\r\n  }\r\n  return -1;\r\n }\r\n\r\n int ergeyilianer(int x, int y, int direct, int Intercept) {\r\n  int player = chessboard[x][y];\r\n  boolean loop = false;\r\n  if (Intercept == 0) {\r\n   Intercept = 1;\r\n   loop = true;\r\n  }\r\n\r\n  int _x = 0, _y = 0;\r\n  if (Intercept == 1) { \/\/ \u9996\u68cb\u5b50\u88ab\u5835\uff0c\u5c3e\u68cb\u5b50\u6ca1\u6709\u88ab\u5835\r\n   switch (direct) {\r\n   case 0:\r\n    _x = 3;\r\n    break;\r\n   case 1:\r\n    _x = _y = 3;\r\n    break;\r\n   case 2:\r\n    _y = 3;\r\n    break;\r\n   case 3:\r\n    _x = -3;\r\n    _y = 3;\r\n    break;\r\n   case 4:\r\n    _x = -3;\r\n    break;\r\n   case 5:\r\n    _x = _y = -3;\r\n    break;\r\n   case 6:\r\n    _y = -3;\r\n    break;\r\n   case 7:\r\n    _x = 3;\r\n    _y = -3;\r\n    break;\r\n   }\r\n   try {\r\n    if (chessboard[x + _x][y + _y] == player) {\r\n     if (_x == 3)\r\n      _x = 4;\r\n     if (_x == -3)\r\n      _x = -4;\r\n     if (_y == 3)\r\n      _y = 4;\r\n     if (_y == -3)\r\n      _y = -4;\r\n     if (chessboard[x + _x][y + _y] == player) {\r\n      return Intercept;\r\n     } else {\r\n      if (loop) {\r\n       Intercept = 2;\r\n       loop = false;\r\n      }\r\n     }\r\n    } else {\r\n     if (loop) {\r\n      Intercept = 2;\r\n      loop = false;\r\n     }\r\n    }\r\n\r\n   } catch (Exception e) {\r\n    \/\/ TODO: handle exception\r\n    if (loop) {\r\n     Intercept = 2;\r\n     loop = false;\r\n    }\r\n   }\r\n  }\r\n\r\n  if (Intercept == 2) { \/\/ \u9996\u68cb\u5b50\u88ab\u5835\uff0c\u5c3e\u68cb\u5b50\u6ca1\u6709\u88ab\u5835\r\n   switch (direct) {\r\n   case 0:\r\n    _x = -2;\r\n    break;\r\n   case 1:\r\n    _x = _y = -2;\r\n    break;\r\n   case 2:\r\n    _y = -2;\r\n    break;\r\n   case 3:\r\n    _x = 2;\r\n    _y = -2;\r\n    break;\r\n   case 4:\r\n    _x = 2;\r\n    break;\r\n   case 5:\r\n    _x = _y = 2;\r\n    break;\r\n   case 6:\r\n    _y = 2;\r\n    break;\r\n   case 7:\r\n    _x = -2;\r\n    _y = 2;\r\n    break;\r\n   }\r\n   try {\r\n    if (chessboard[x + _x][y + _y] == player) {\r\n     if (_x == 2)\r\n      _x = 3;\r\n     if (_x == -2)\r\n      _x = -3;\r\n     if (_y == 2)\r\n      _y = 3;\r\n     if (_y == -2)\r\n      _y = -3;\r\n     if (chessboard[x + _x][y + _y] == player) {\r\n      return Intercept;\r\n     } else {\r\n      return -1;\r\n     }\r\n    } else {\r\n     return -1;\r\n    }\r\n\r\n   } catch (Exception e) {\r\n    \/\/ TODO: handle exception\r\n    return -1;\r\n   }\r\n  }\r\n  if (loop) {\r\n   Intercept = 2;\r\n   if (ergeyilianer(x, y, direct, Intercept) != -1)\r\n    return Intercept;\r\n  }\r\n  return -1;\r\n }\r\n\r\n int ergeyilianyi(int x, int y, int direct, int Intercept) {\r\n  int player = chessboard[x][y];\r\n  int opponent = 0;\r\n  if (player == 1)\r\n   opponent = 2;\r\n  else {\r\n   opponent = 1;\r\n  }\r\n  boolean loop = false;\r\n  if (Intercept == 0) {\r\n   Intercept = 1;\r\n   loop = true;\r\n  }\r\n\r\n  int _x = 0, _y = 0;\r\n  if (Intercept == 1) { \/\/ \u9996\u68cb\u5b50\u88ab\u5835\r\n   switch (direct) {\r\n   case 0:\r\n    _x = 3;\r\n    break;\r\n   case 1:\r\n    _x = _y = 3;\r\n    break;\r\n   case 2:\r\n    _y = 3;\r\n    break;\r\n   case 3:\r\n    _x = -3;\r\n    _y = 3;\r\n    break;\r\n   case 4:\r\n    _x = -3;\r\n    break;\r\n   case 5:\r\n    _x = _y = -3;\r\n    break;\r\n   case 6:\r\n    _y = -3;\r\n    break;\r\n   case 7:\r\n    _x = 3;\r\n    _y = -3;\r\n    break;\r\n   }\r\n   try {\r\n    if (chessboard[x + _x][y + _y] == player) {\r\n     switch (direct) {\r\n     case 0:\r\n      _x = 4;\r\n      break;\r\n     case 1:\r\n      _x = _y = 4;\r\n      break;\r\n     case 2:\r\n      _y = 4;\r\n      break;\r\n     case 3:\r\n      _x = -4;\r\n      _y = 4;\r\n      break;\r\n     case 4:\r\n      _x = -4;\r\n      break;\r\n     case 5:\r\n      _x = _y = -4;\r\n      break;\r\n     case 6:\r\n      _y = -4;\r\n      break;\r\n     case 7:\r\n      _x = 4;\r\n      _y = -4;\r\n      break;\r\n     }\r\n     if (chessboard[x + _x][y + _y] != opponent)\r\n      return Intercept;\r\n     else {\r\n      if (loop) {\r\n       Intercept = 2;\r\n       loop = false;\r\n      }\r\n     }\r\n    } else {\r\n     if (loop) {\r\n      Intercept = 2;\r\n      loop = false;\r\n     }\r\n    }\r\n\r\n   } catch (Exception e) {\r\n    \/\/ TODO: handle exception\r\n    if (loop) {\r\n     Intercept = 2;\r\n     loop = false;\r\n    }\r\n   }\r\n  }\r\n\r\n  if (Intercept == 2) { \/\/ \u5c3e\u68cb\u5b50\u88ab\u5835\uff0c\u9996\u68cb\u5b50\u6ca1\u6709\u88ab\u5835\r\n   switch (direct) {\r\n   case 0:\r\n    _x = -2;\r\n    break;\r\n   case 1:\r\n    _x = _y = -2;\r\n    break;\r\n   case 2:\r\n    _y = -2;\r\n    break;\r\n   case 3:\r\n    _x = 2;\r\n    _y = -2;\r\n    break;\r\n   case 4:\r\n    _x = 2;\r\n    break;\r\n   case 5:\r\n    _x = _y = 2;\r\n    break;\r\n   case 6:\r\n    _y = 2;\r\n    break;\r\n   case 7:\r\n    _x = -2;\r\n    _y = 2;\r\n    break;\r\n   }\r\n   try {\r\n    if (chessboard[x + _x][y + _y] == player) {\r\n     switch (direct) {\r\n     case 0:\r\n      _x = -3;\r\n      break;\r\n     case 1:\r\n      _x = _y = -3;\r\n      break;\r\n     case 2:\r\n      _y = -3;\r\n      break;\r\n     case 3:\r\n      _x = 3;\r\n      _y = -3;\r\n      break;\r\n     case 4:\r\n      _x = 3;\r\n      break;\r\n     case 5:\r\n      _x = _y = 3;\r\n      break;\r\n     case 6:\r\n      _y = 3;\r\n      break;\r\n     case 7:\r\n      _x = -3;\r\n      _y = 3;\r\n      break;\r\n     }\r\n     if (chessboard[x + _x][y + _y] != opponent)\r\n      return Intercept;\r\n     else {\r\n      return -1;\r\n     }\r\n    } else {\r\n     return -1;\r\n    }\r\n\r\n   } catch (Exception e) {\r\n    \/\/ TODO: handle exception\r\n    return -1;\r\n   }\r\n  }\r\n  if (loop) {\r\n   Intercept = 2;\r\n   if (ergeyilianyi(x, y, direct, Intercept) != -1)\r\n    return Intercept;\r\n  }\r\n  return -1;\r\n }\r\n\r\n boolean Liansi(int x, int y, int direct, int Intercept) {\r\n  int player = chessboard[x][y];\r\n  int _x = 0, _y = 0;\r\n  if (Intercept == 1) {\r\n   switch (direct) {\r\n   case 0:\r\n    _x = 4;\r\n    break;\r\n   case 1:\r\n    _x = 4;\r\n    _y = 4;\r\n    break;\r\n   case 2:\r\n    _y = 4;\r\n    break;\r\n   case 3:\r\n    _x = -4;\r\n    _y = 4;\r\n    break;\r\n   case 4:\r\n    _x = -4;\r\n    break;\r\n   case 5:\r\n    _x = -4;\r\n    _y = -4;\r\n    break;\r\n   case 6:\r\n    _y = -4;\r\n    break;\r\n   case 7:\r\n    _x = 4;\r\n    _y = -4;\r\n    break;\r\n   }\r\n   try {\r\n    if (chessboard[x + _x][y + _y] == 0\r\n      || chessboard[x + _x][y + _y] == player) {\r\n     return true;\r\n    } else {\r\n     return false;\r\n    }\r\n   } catch (Exception e) {\r\n    \/\/ TODO: handle exception\r\n    return false;\r\n   }\r\n  }\r\n\r\n  if (Intercept == 2) {\r\n   switch (direct) {\r\n   case 0:\r\n    _x = -2;\r\n    break;\r\n   case 1:\r\n    _x = -2;\r\n    _y = -2;\r\n    break;\r\n   case 2:\r\n    _y = -2;\r\n    break;\r\n   case 3:\r\n    _x = 2;\r\n    _y = -2;\r\n    break;\r\n   case 4:\r\n    _x = 2;\r\n    break;\r\n   case 5:\r\n    _x = 2;\r\n    _y = 2;\r\n    break;\r\n   case 6:\r\n    _y = 2;\r\n    break;\r\n   case 7:\r\n    _x = -2;\r\n    _y = 2;\r\n    break;\r\n   default:\r\n    break;\r\n   }\r\n   try {\r\n    if (chessboard[x + _x][y + _y] == 0\r\n      || chessboard[x + _x][y + _y] == player) {\r\n     return true;\r\n    } else {\r\n     return false;\r\n    }\r\n   } catch (Exception e) {\r\n    \/\/ TODO: handle exception\r\n    return false;\r\n   }\r\n  }\r\n  return false;\r\n }\r\n\r\n int[] Check_Cross(int player) {\r\n  int opponent;\r\n  if (player == 1)\r\n   opponent = 2;\r\n  else {\r\n   opponent = 1;\r\n  }\r\n  int x = 0, y = 0;\r\n  int[] coord_t = new int[2];\r\n  coord_t[0] = coord_t[1] = -1;\r\n  for (y = 0; y &lt; 23; y++) {\r\n   for (x = 0; x &lt; 23; x++) {\r\n    if (chessboard[x][y] == 0)\r\n     try {\r\n      if (chessboard[x + 1][y] == player) {\r\n       if (chessboard[x + 2][y] != opponent)\r\n        if (chessboard[x - 1][y] == player)\r\n         if (chessboard[x - 2][y] != opponent) {\r\n          try {\r\n           if (chessboard[x][y + 1] == player)\r\n            if (chessboard[x][y + 2] != opponent)\r\n             if (chessboard[x][y - 1] == player)\r\n              if (chessboard[x][y - 2] != opponent) {\r\n               coord_t[0] = x;\r\n               coord_t[1] = y;\r\n               return coord_t;\r\n              }\r\n          } catch (Exception e) {\r\n           \/\/ TODO: handle exception\r\n          }\r\n          try {\r\n           if (chessboard[x + 1][y + 1] == player)\r\n            if (chessboard[x + 2][y + 2] != opponent)\r\n             if (chessboard[x - 1][y - 1] == player)\r\n              if (chessboard[x - 2][y - 2] != opponent) {\r\n               coord_t[0] = x;\r\n               coord_t[1] = y;\r\n               return coord_t;\r\n              }\r\n          } catch (Exception e) {\r\n           \/\/ TODO: handle exception\r\n          }\r\n          try {\r\n           if (chessboard[x + 1][y - 1] == player)\r\n            if (chessboard[x + 2][y - 2] != opponent)\r\n             if (chessboard[x - 1][y + 1] == player)\r\n              if (chessboard[x - 2][y + 2] != opponent) {\r\n               coord_t[0] = x;\r\n               coord_t[1] = y;\r\n               return coord_t;\r\n              }\r\n          } catch (Exception e) {\r\n           \/\/ TODO: handle exception\r\n          }\r\n         }\r\n      }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n      continue;\r\n     }\r\n    try {\r\n     if (chessboard[x][y + 1] == player)\r\n      if (chessboard[x][y + 2] != opponent)\r\n       if (chessboard[x][y - 1] == player)\r\n        if (chessboard[x][y - 2] != opponent) {\r\n         try {\r\n          if (chessboard[x + 1][y + 1] == player)\r\n           if (chessboard[x + 2][y + 2] != opponent)\r\n            if (chessboard[x - 1][y - 1] == player)\r\n             if (chessboard[x - 2][y - 2] != opponent) {\r\n              coord_t[0] = x;\r\n              coord_t[1] = y;\r\n              return coord_t;\r\n             }\r\n         } catch (Exception e) {\r\n          \/\/ TODO: handle exception\r\n         }\r\n         try {\r\n          if (chessboard[x - 1][y + 1] == player)\r\n           if (chessboard[x - 2][y + 2] != opponent)\r\n            if (chessboard[x + 1][y - 1] == player)\r\n             if (chessboard[x + 2][y - 2] != opponent) {\r\n              coord_t[0] = x;\r\n              coord_t[1] = y;\r\n              return coord_t;\r\n             }\r\n         } catch (Exception e) {\r\n          \/\/ TODO: handle exception\r\n         }\r\n        }\r\n    } catch (Exception e) {\r\n     \/\/ TODO: handle exception\r\n    }\r\n    try {\r\n     if (chessboard[x + 1][y + 1] == player) {\r\n      if (chessboard[x + 2][y + 2] != opponent)\r\n       if (chessboard[x - 1][y - 1] == player)\r\n        if (chessboard[x - 2][y - 2] != opponent) {\r\n         try {\r\n          if (chessboard[x - 1][y + 1] == player)\r\n           if (chessboard[x - 2][y + 2] != opponent)\r\n            if (chessboard[x + 1][y - 1] == player)\r\n             if (chessboard[x + 2][y - 2] != opponent) {\r\n              coord_t[0] = x;\r\n              coord_t[1] = y;\r\n              return coord_t;\r\n             }\r\n         } catch (Exception e) {\r\n          \/\/ TODO: handle exception\r\n         }\r\n        }\r\n     }\r\n    } catch (Exception e) {\r\n     \/\/ TODO: handle exception\r\n     continue;\r\n    }\r\n   }\r\n  }\r\n  return coord_t;\r\n }\r\n\r\n int[] yigeyi(int player) {\r\n  int opponent;\r\n  if (player == 1)\r\n   opponent = 2;\r\n  else {\r\n   opponent = 1;\r\n  }\r\n  int x, y;\r\n  int[] coord_t = new int[2];\r\n  coord_t[0] = coord_t[1] = -1;\r\n\r\n  for (y = 0; y &lt; 23; y++) {\r\n   for (x = 0; x &lt; 23; x++) {\r\n    if (chessboard[x][y] == 0)\r\n     try {\r\n      if (chessboard[x + 1][y] == player) {\r\n       if (chessboard[x + 2][y] != opponent)\r\n        if (chessboard[x - 1][y] == player)\r\n         if (chessboard[x - 2][y] != opponent) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n      }\r\n      if (chessboard[x + 1][y + 1] == player) {\r\n       if (chessboard[x + 2][y + 2] != opponent)\r\n        if (chessboard[x - 1][y - 1] == player)\r\n         if (chessboard[x - 2][y - 2] != opponent) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n      }\r\n      if (chessboard[x][y + 1] == player) {\r\n       if (chessboard[x][y + 2] != opponent)\r\n        if (chessboard[x][y - 1] == player)\r\n         if (chessboard[x][y - 2] != opponent) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n      }\r\n      if (chessboard[x - 1][y + 1] == player) {\r\n       if (chessboard[x - 2][y + 2] != opponent)\r\n        if (chessboard[x + 1][y - 1] == player)\r\n         if (chessboard[x + 2][y - 2] != opponent) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n      }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n      continue;\r\n     }\r\n   }\r\n  }\r\n\r\n  return coord_t;\r\n }\r\n\r\n boolean Liansan(int x, int y, int direct) {\r\n  int _x = 0, _y = 0;\r\n  for (int i = 0; i &lt; 5; i++) {\r\n   switch (direct) {\r\n   case 0:\r\n    _x++;\r\n    break;\r\n   case 1:\r\n    _x++;\r\n    _y++;\r\n    break;\r\n   case 2:\r\n    _y++;\r\n    break;\r\n   case 3:\r\n    _x--;\r\n    _y++;\r\n    break;\r\n   case 4:\r\n    _x--;\r\n    break;\r\n   case 5:\r\n    _x--;\r\n    _y--;\r\n   case 6:\r\n    _y--;\r\n    break;\r\n   case 7:\r\n    _y--;\r\n    _x++;\r\n    break;\r\n   default:\r\n    break;\r\n   }\r\n   try {\r\n    if (chessboard[x + _x][y + _y] == 2) {\r\n     return false;\r\n    }\r\n    if (Math.abs(_x) == 4) {\r\n     return true;\r\n    }\r\n   } catch (Exception e) {\r\n    \/\/ TODO: handle exception\r\n    return false;\r\n   }\r\n  }\r\n  return false;\r\n }\r\n\r\n int[] duanjiajiao(int player) {\r\n  int x = 0, y = 0;\r\n  int[] coord_t = new int[2];\r\n  coord_t[0] = coord_t[1] = -1;\r\n  int opponrnt = 0;\r\n  if (player == 1)\r\n   opponrnt = 2;\r\n  else {\r\n   opponrnt = 1;\r\n  }\r\n  for (y = 0; y &lt; 23; y++) {\r\n   for (x = 0; x &lt; 23; x++) {\r\n    if (chessboard[x][y] == 0) {\r\n     try { \/\/ \u8bd5\u63a20\u65b9\u5411\r\n      if (chessboard[x + 1][y] == player\r\n        &amp;&amp; chessboard[x + 2][y] == player)\r\n       if (chessboard[x + 3][y] != opponrnt)\r\n        if (chessboard[x - 1][y] != opponrnt)\r\n         if (duanjiajiao_judgement(x, y, 0, player) != -1) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a21\u65b9\u5411\r\n      if (chessboard[x + 1][y + 1] == player\r\n        &amp;&amp; chessboard[x + 2][y + 2] == player)\r\n       if (chessboard[x + 3][y + 3] != opponrnt)\r\n        if (chessboard[x - 1][y - 1] != opponrnt)\r\n         if (duanjiajiao_judgement(x, y, 1, player) != -1) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a22\u65b9\u5411\r\n      if (chessboard[x][y + 1] == player\r\n        &amp;&amp; chessboard[x][y + 2] == player)\r\n       if (chessboard[x][y + 3] != opponrnt)\r\n        if (chessboard[x][y - 1] != opponrnt)\r\n         if (duanjiajiao_judgement(x, y, 2, player) != -1) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a23\u65b9\u5411\r\n      if (chessboard[x - 1][y + 1] == player\r\n        &amp;&amp; chessboard[x - 2][y + 2] == player)\r\n       if (chessboard[x - 3][y + 3] != opponrnt)\r\n        if (chessboard[x + 1][y - 1] != opponrnt)\r\n         if (duanjiajiao_judgement(x, y, 3, player) != -1) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a24\u65b9\u5411\r\n      if (chessboard[x - 1][y] == player\r\n        &amp;&amp; chessboard[x - 2][y] == player)\r\n       if (chessboard[x - 3][y] != opponrnt)\r\n        if (chessboard[x + 1][y] != opponrnt)\r\n         if (duanjiajiao_judgement(x, y, 4, player) != -1) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a25\u65b9\u5411\r\n      if (chessboard[x - 1][y - 1] == player\r\n        &amp;&amp; chessboard[x - 2][y - 2] == player)\r\n       if (chessboard[x - 3][y - 3] != opponrnt)\r\n        if (chessboard[x + 1][y + 1] != opponrnt)\r\n         if (duanjiajiao_judgement(x, y, 5, player) != -1) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a26\u65b9\u5411\r\n      if (chessboard[x][y - 1] == player\r\n        &amp;&amp; chessboard[x][y - 2] == player)\r\n       if (chessboard[x][y - 3] != opponrnt)\r\n        if (chessboard[x][y + 1] != opponrnt)\r\n         if (duanjiajiao_judgement(x, y, 6, player) != -1) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a27\u65b9\u5411\r\n      if (chessboard[x + 1][y - 1] == player\r\n        &amp;&amp; chessboard[x + 2][y - 2] == player)\r\n       if (chessboard[x + 3][y - 3] != opponrnt)\r\n        if (chessboard[x - 1][y + 1] != opponrnt)\r\n         if (duanjiajiao_judgement(x, y, 7, player) != -1) {\r\n          coord_t[0] = x;\r\n          coord_t[1] = y;\r\n          return coord_t;\r\n         }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n    }\r\n   }\r\n  }\r\n  return coord_t;\r\n }\r\n\r\n int duanjiajiao_judgement(int x, int y, int mydirect, int player) {\r\n\r\n  int direct;\r\n  if (mydirect == 7)\r\n   direct = 0;\r\n  else {\r\n   direct = mydirect + 1;\r\n  }\r\n  int _x = 0, _y = 0, i = 0, k = 0;\r\n  int opponent = 0;\r\n  if (player == 1)\r\n   opponent = 2;\r\n  else {\r\n   opponent = 1;\r\n  }\r\n  for (i = 0, _x = _y = 0; i &lt; 7; i++) {\r\n   for (k = 0; k &lt; 3; k++) {\r\n    switch (direct) {\r\n    case 0:\r\n     _x++;\r\n     break;\r\n    case 1:\r\n     _x++;\r\n     _y++;\r\n     break;\r\n    case 2:\r\n     _y++;\r\n     break;\r\n    case 3:\r\n     _x--;\r\n     _y++;\r\n     break;\r\n    case 4:\r\n     _x--;\r\n     break;\r\n    case 5:\r\n     _y--;\r\n     _x--;\r\n     break;\r\n    case 6:\r\n     _y--;\r\n     break;\r\n    case 7:\r\n     _x++;\r\n     _y--;\r\n     break;\r\n    }\r\n    try {\r\n     if (chessboard[x + _x][y + _y] != opponent\r\n       &amp;&amp; chessboard[x + _x][y + _y] != 0) {\r\n      if (k == 1) {\r\n       switch (direct) {\r\n       case 0:\r\n        _x++;\r\n        break;\r\n       case 1:\r\n        _x++;\r\n        _y++;\r\n        break;\r\n       case 2:\r\n        _y++;\r\n        break;\r\n       case 3:\r\n        _x--;\r\n        _y++;\r\n        break;\r\n       case 4:\r\n        _x--;\r\n        break;\r\n       case 5:\r\n        _y--;\r\n        _x--;\r\n        break;\r\n       case 6:\r\n        _y--;\r\n        break;\r\n       case 7:\r\n        _x++;\r\n        _y--;\r\n        break;\r\n       }\r\n       try {\r\n        if (chessboard[x + _x][y + _y] != opponent) {\r\n         return direct;\r\n        } else {\r\n         direct++;\r\n         if (direct == 8) {\r\n          direct = 0;\r\n         }\r\n         _x = _y = 0;\r\n         break;\r\n        }\r\n       } catch (Exception e) {\r\n        \/\/ TODO: handle exception\r\n        direct++;\r\n        if (direct == 8) {\r\n         direct = 0;\r\n        }\r\n        _x = _y = 0;\r\n        break;\r\n       }\r\n\r\n      }\r\n     } else {\r\n      direct++;\r\n      if (direct == 8) {\r\n       direct = 0;\r\n      }\r\n      _x = _y = 0;\r\n      break;\r\n     }\r\n    } catch (Exception e) {\r\n     \/\/ TODO: handle exception\r\n     direct++;\r\n     if (direct == 8) {\r\n      direct = 0;\r\n     }\r\n     _x = _y = 0;\r\n     break;\r\n    }\r\n   }\r\n  }\r\n  return -1;\r\n }\r\n\r\n int[] duanjiajiao_siliansan(int player) {\r\n  int x = 0, y = 0;\r\n  int jiajiao_direct = 0;\r\n  int[] coord_t = new int[2];\r\n  coord_t[0] = coord_t[1] = -1;\r\n  int opponrnt = 0;\r\n  if (player == 1)\r\n   opponrnt = 2;\r\n  else {\r\n   opponrnt = 1;\r\n  }\r\n  for (y = 0; y &lt; 23; y++) {\r\n   for (x = 0; x &lt; 23; x++) {\r\n    if (chessboard[x][y] == 0) {\r\n     try { \/\/ \u8bd5\u63a20\u65b9\u5411\r\n      if (chessboard[x + 1][y] == player\r\n        &amp;&amp; chessboard[x + 2][y] == player)\r\n       if (chessboard[x + 3][y] != opponrnt)\r\n        if (chessboard[x - 1][y] != opponrnt)\r\n         if ((jiajiao_direct = duanjiajiao_judgement(\r\n           x, y, 0, player)) != -1)\r\n          if (duanjiajiao_judgement_siliansan(x,\r\n            y, 0, jiajiao_direct, player)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a21\u65b9\u5411\r\n      if (chessboard[x + 1][y + 1] == player\r\n        &amp;&amp; chessboard[x + 2][y + 2] == player)\r\n       if (chessboard[x + 3][y + 3] != opponrnt)\r\n        if (chessboard[x - 1][y - 1] != opponrnt)\r\n         if ((jiajiao_direct = duanjiajiao_judgement(\r\n           x, y, 1, player)) != -1)\r\n          if (duanjiajiao_judgement_siliansan(x,\r\n            y, 1, jiajiao_direct, player)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a22\u65b9\u5411\r\n      if (chessboard[x][y + 1] == player\r\n        &amp;&amp; chessboard[x][y + 2] == player)\r\n       if (chessboard[x][y + 3] != opponrnt)\r\n        if (chessboard[x][y - 1] != opponrnt)\r\n         if ((jiajiao_direct = duanjiajiao_judgement(\r\n           x, y, 2, player)) != -1)\r\n          if (duanjiajiao_judgement_siliansan(x,\r\n            y, 2, jiajiao_direct, player)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a23\u65b9\u5411\r\n      if (chessboard[x - 1][y + 1] == player\r\n        &amp;&amp; chessboard[x - 2][y + 2] == player)\r\n       if (chessboard[x - 3][y + 3] != opponrnt)\r\n        if (chessboard[x + 1][y - 1] != opponrnt)\r\n         if ((jiajiao_direct = duanjiajiao_judgement(\r\n           x, y, 3, player)) != -1)\r\n          if (duanjiajiao_judgement_siliansan(x,\r\n            y, 3, jiajiao_direct, player)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a24\u65b9\u5411\r\n      if (chessboard[x - 1][y] == player\r\n        &amp;&amp; chessboard[x - 2][y] == player)\r\n       if (chessboard[x - 3][y] != opponrnt)\r\n        if (chessboard[x + 1][y] != opponrnt)\r\n         if ((jiajiao_direct = duanjiajiao_judgement(\r\n           x, y, 4, player)) != -1)\r\n          if (duanjiajiao_judgement_siliansan(x,\r\n            y, 4, jiajiao_direct, player)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a25\u65b9\u5411\r\n      if (chessboard[x - 1][y - 1] == player\r\n        &amp;&amp; chessboard[x - 2][y - 2] == player)\r\n       if (chessboard[x - 3][y - 3] != opponrnt)\r\n        if (chessboard[x + 1][y + 1] != opponrnt)\r\n         if ((jiajiao_direct = duanjiajiao_judgement(\r\n           x, y, 5, player)) != -1)\r\n          if (duanjiajiao_judgement_siliansan(x,\r\n            y, 5, jiajiao_direct, player)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a26\u65b9\u5411\r\n      if (chessboard[x][y - 1] == player\r\n        &amp;&amp; chessboard[x][y - 2] == player)\r\n       if (chessboard[x][y - 3] != opponrnt)\r\n        if (chessboard[x][y + 1] != opponrnt)\r\n         if ((jiajiao_direct = duanjiajiao_judgement(\r\n           x, y, 6, player)) != -1)\r\n          if (duanjiajiao_judgement_siliansan(x,\r\n            y, 6, jiajiao_direct, player)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n\r\n     try { \/\/ \u8bd5\u63a27\u65b9\u5411\r\n      if (chessboard[x + 1][y - 1] == player\r\n        &amp;&amp; chessboard[x + 2][y - 2] == player)\r\n       if (chessboard[x + 3][y - 3] != opponrnt)\r\n        if (chessboard[x - 1][y + 1] != opponrnt)\r\n         if ((jiajiao_direct = duanjiajiao_judgement(\r\n           x, y, 7, player)) != -1)\r\n          if (duanjiajiao_judgement_siliansan(x,\r\n            y, 7, jiajiao_direct, player)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n    }\r\n   }\r\n  }\r\n  return coord_t;\r\n }\r\n\r\n boolean duanjiajiao_judgement_siliansan(int x, int y, int direct_1,\r\n   int direct_2, int player) {\r\n  int _x = 0, _y = 0;\r\n  boolean playid_1 = false;\r\n  boolean playid_2 = false;\r\n  switch (direct_1) {\r\n  case 0:\r\n   _x = 4;\r\n   break;\r\n  case 1:\r\n   _x = 4;\r\n   _y = 4;\r\n   break;\r\n  case 2:\r\n   _y = 4;\r\n   break;\r\n  case 3:\r\n   _x = -4;\r\n   _y = 4;\r\n   break;\r\n  case 4:\r\n   _x = -4;\r\n   break;\r\n  case 5:\r\n   _x = -4;\r\n   _y = -4;\r\n   break;\r\n  case 6:\r\n   _y = -4;\r\n   break;\r\n  case 7:\r\n   _y = -4;\r\n   _x = 4;\r\n   break;\r\n  default:\r\n   break;\r\n  }\r\n  try {\r\n   if (chessboard[x + _x][y + _y] == player) {\r\n    playid_1 = true;\r\n   } else {\r\n    playid_1 = false;\r\n   }\r\n  } catch (Exception e) {\r\n   \/\/ TODO: handle exception\r\n   playid_1 = false;\r\n  }\r\n  switch (direct_2) {\r\n  case 0:\r\n   _x = 4;\r\n   break;\r\n  case 1:\r\n   _x = 4;\r\n   _y = 4;\r\n   break;\r\n  case 2:\r\n   _y = 4;\r\n   break;\r\n  case 3:\r\n   _x = -4;\r\n   _y = 4;\r\n   break;\r\n  case 4:\r\n   _x = -4;\r\n   break;\r\n  case 5:\r\n   _x = -4;\r\n   _y = -4;\r\n   break;\r\n  case 6:\r\n   _y = -4;\r\n   break;\r\n  case 7:\r\n   _y = -4;\r\n   _x = 4;\r\n   break;\r\n  default:\r\n   break;\r\n  }\r\n  try {\r\n   if (chessboard[x + _x][y + _y] == player) {\r\n    playid_2 = true;\r\n   } else {\r\n    playid_2 = false;\r\n   }\r\n  } catch (Exception e) {\r\n   \/\/ TODO: handle exception\r\n   playid_2 = false;\r\n  }\r\n  if (playid_1 || playid_2)\r\n   return true;\r\n  return false;\r\n }\r\n\r\n int[] T_pattern(int player) {\r\n  int[] coord_t = new int[2];\r\n  coord_t[0] = coord_t[1] = -1;\r\n  int opponent;\r\n  if (player == 1)\r\n   opponent = 2;\r\n  else {\r\n   opponent = 2;\r\n  }\r\n  for (int y = 0; y &lt; 23; y++) {\r\n   for (int x = 0; x &lt; 23; x++) {\r\n    if (chessboard[x][y] == 0) {\r\n     try { \/\/ \u8bd5\u63a21\u65b9\u5411\r\n      if (chessboard[x + 1][y] == player)\r\n       if (chessboard[x + 2][y] != opponent)\r\n        if (chessboard[x - 1][y] == player)\r\n         if (chessboard[x - 2][y] != opponent)\r\n          if (T_pattern_judgement(x, y, player, 1)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n     try { \/\/ \u8bd5\u63a22\u65b9\u5411\r\n      if (chessboard[x + 1][y + 1] == player)\r\n       if (chessboard[x + 2][y + 2] != opponent)\r\n        if (chessboard[x - 1][y - 1] == player)\r\n         if (chessboard[x - 2][y - 2] != opponent)\r\n          if (T_pattern_judgement(x, y, player, 2)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n     try { \/\/ \u8bd5\u63a23\u65b9\u5411\r\n      if (chessboard[x][y + 1] == player)\r\n       if (chessboard[x][y + 2] != opponent)\r\n        if (chessboard[x][y - 1] == player)\r\n         if (chessboard[x][y - 2] != opponent)\r\n          if (T_pattern_judgement(x, y, player, 3)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n     try { \/\/ \u8bd5\u63a24\u65b9\u5411\r\n      if (chessboard[x - 1][y + 1] == player)\r\n       if (chessboard[x - 2][y + 2] != opponent)\r\n        if (chessboard[x + 1][y - 1] == player)\r\n         if (chessboard[x + 2][y - 2] != opponent)\r\n          if (T_pattern_judgement(x, y, player, 4)) {\r\n           coord_t[0] = x;\r\n           coord_t[1] = y;\r\n           return coord_t;\r\n          }\r\n     } catch (Exception e) {\r\n      \/\/ TODO: handle exception\r\n     }\r\n    }\r\n   }\r\n  }\r\n  return coord_t;\r\n }\r\n\r\n boolean T_pattern_judgement(int x, int y, int player, int direct) {\r\n  int _x = 0, _y = 0;\r\n  int opponent = 0;\r\n  int skip_direction;\r\n  int num = 0;\r\n  if (player == 1)\r\n   opponent = 2;\r\n  else {\r\n   opponent = 1;\r\n  }\r\n  switch (direct) {\r\n  case 1:\r\n   skip_direction = 4;\r\n   break;\r\n  case 2:\r\n   skip_direction = 5;\r\n   break;\r\n  case 3:\r\n   skip_direction = 6;\r\n   break;\r\n  case 4:\r\n   skip_direction = 7;\r\n   break;\r\n  default:\r\n   return false;\r\n  }\r\n  for (int i = 0; i &lt; 7;) {\r\n   if (direct == skip_direction) {\r\n    direct++;\r\n    i++;\r\n    _x = _y = 0;\r\n    continue;\r\n   }\r\n   if (direct == 8) {\r\n    direct = 0;\r\n   }\r\n   switch (direct) {\r\n   case 0:\r\n    _x++;\r\n    break;\r\n   case 1:\r\n    _x++;\r\n    _y++;\r\n    break;\r\n   case 2:\r\n    _y++;\r\n    break;\r\n   case 3:\r\n    _y++;\r\n    _x--;\r\n    break;\r\n   case 4:\r\n    _x--;\r\n    break;\r\n   case 5:\r\n    _x--;\r\n    _y--;\r\n    break;\r\n   case 6:\r\n    _y--;\r\n    break;\r\n   case 7:\r\n    _y--;\r\n    _x++;\r\n    break;\r\n   }\r\n   try {\r\n    if (num &lt; 2) {\r\n     if (chessboard[x + _x][y + _y] == player) {\r\n      num++;\r\n     } else {\r\n      direct++;\r\n      i++;\r\n      _x = _y = 0;\r\n     }\r\n    } else {\r\n     if (chessboard[x + _x][y + _y] != opponent) {\r\n      if (_x == 3)\r\n       _x = -1;\r\n      if (_x == -3)\r\n       _x = 1;\r\n      if (_y == 3)\r\n       _y = -1;\r\n      if (_y == -3)\r\n       _y = 1;\r\n      if (chessboard[x + _x][y + _y] != opponent) {\r\n       return true;\r\n      } else {\r\n       direct++;\r\n       i++;\r\n       _x = _y = 0;\r\n      }\r\n\r\n     } else {\r\n      if (_x == 3)\r\n       _x = -1;\r\n      if (_x == -3)\r\n       _x = 1;\r\n      if (_y == 3)\r\n       _y = -1;\r\n      if (_y == -3)\r\n       _y = 1;\r\n      if (chessboard[x + _x][y + _y] != opponent) {\r\n       if (_x == -1)\r\n        _x = -2;\r\n       if (_x == 1)\r\n        _x = 2;\r\n       if (_y == 1)\r\n        _y = 2;\r\n       if (_y == -1)\r\n        _y = 2;\r\n       if (chessboard[x + _x][y + _y] != opponent)\r\n        return true;\r\n       else {\r\n        direct++;\r\n        i++;\r\n        _x = _y = 0;\r\n       }\r\n      } else {\r\n       direct++;\r\n       i++;\r\n       _x = _y = 0;\r\n      }\r\n     }\r\n    }\r\n\r\n   } catch (Exception e) {\r\n    \/\/ TODO: handle exception\r\n    direct++;\r\n    i++;\r\n    _x = _y = 0;\r\n   }\r\n  }\r\n  return false;\r\n }\r\n\r\n int[] irregular() {\r\n  int x, y;\r\n  int[] coord_t = new int[2];\r\n  for (y = 0; y &lt; 23; y++) {\r\n   for (x = 0; x &lt; 23; x++) {\r\n    if (chessboard[x][y] == 0) {\r\n     coord_t[0] = x;\r\n     coord_t[1] = y;\r\n     return coord_t;\r\n    }\r\n   }\r\n  }\r\n  return coord_t;\r\n }\r\n}<\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p><pre class=\"brush:java; toolbar: true; auto-links: true;\">\u4f7f\u7528\u4e86\u535a\u5f08\u6811\u548c\u526a\u679d\u7b97\u6cd5\uff0c\u81f3\u4e8e\u6c34\u5e73\u5982\u4f55\uff0c\u53cd\u6b63\u4f5c\u4e3a\u4f5c\u8005\u6211\u662f\u4e0b\u4e0d\u8fc7\u5b83\u3002<\/pre>\n<\/p>\n<p>\n\t<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[325],"tags":[],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>AI\u7248\u4e94\u5b50\u68cb - Wayne&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/weizn.net\/?p=36\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AI\u7248\u4e94\u5b50\u68cb - Wayne&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"\u4f7f\u7528\u4e86\u535a\u5f08\u6811\u548c\u526a\u679d\u7b97\u6cd5\uff0c\u81f3\u4e8e\u6c34\u5e73\u5982\u4f55\uff0c\u53cd\u6b63\u4f5c\u4e3a\u4f5c\u8005\u6211\u662f\u4e0b\u4e0d\u8fc7\u5b83\u3002\" \/>\n<meta property=\"og:url\" content=\"http:\/\/weizn.net\/?p=36\" \/>\n<meta property=\"og:site_name\" content=\"Wayne&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2013-09-06T04:12:18+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"zinan\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"32 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"http:\/\/weizn.net\/#website\",\"url\":\"http:\/\/weizn.net\/\",\"name\":\"Wayne&#039;s Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/weizn.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/weizn.net\/?p=36#webpage\",\"url\":\"http:\/\/weizn.net\/?p=36\",\"name\":\"AI\\u7248\\u4e94\\u5b50\\u68cb - Wayne&#039;s Blog\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/#website\"},\"datePublished\":\"2013-09-06T04:12:18+00:00\",\"dateModified\":\"2013-09-06T04:12:18+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/weizn.net\/?p=36#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/weizn.net\/?p=36\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/weizn.net\/?p=36#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\\u9996\\u9875\",\"item\":\"http:\/\/weizn.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI\\u7248\\u4e94\\u5b50\\u68cb\"}]},{\"@type\":\"Article\",\"@id\":\"http:\/\/weizn.net\/?p=36#article\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/?p=36#webpage\"},\"author\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"headline\":\"AI\\u7248\\u4e94\\u5b50\\u68cb\",\"datePublished\":\"2013-09-06T04:12:18+00:00\",\"dateModified\":\"2013-09-06T04:12:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=36#webpage\"},\"wordCount\":1,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"articleSection\":[\"Java\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/weizn.net\/?p=36#respond\"]}]},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\",\"name\":\"zinan\",\"logo\":{\"@id\":\"http:\/\/weizn.net\/#personlogo\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"AI\u7248\u4e94\u5b50\u68cb - Wayne&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/weizn.net\/?p=36","og_locale":"zh_CN","og_type":"article","og_title":"AI\u7248\u4e94\u5b50\u68cb - Wayne&#039;s Blog","og_description":"\u4f7f\u7528\u4e86\u535a\u5f08\u6811\u548c\u526a\u679d\u7b97\u6cd5\uff0c\u81f3\u4e8e\u6c34\u5e73\u5982\u4f55\uff0c\u53cd\u6b63\u4f5c\u4e3a\u4f5c\u8005\u6211\u662f\u4e0b\u4e0d\u8fc7\u5b83\u3002","og_url":"http:\/\/weizn.net\/?p=36","og_site_name":"Wayne&#039;s Blog","article_published_time":"2013-09-06T04:12:18+00:00","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"zinan","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"32 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"http:\/\/weizn.net\/#website","url":"http:\/\/weizn.net\/","name":"Wayne&#039;s Blog","description":"","publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/weizn.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"http:\/\/weizn.net\/?p=36#webpage","url":"http:\/\/weizn.net\/?p=36","name":"AI\u7248\u4e94\u5b50\u68cb - Wayne&#039;s Blog","isPartOf":{"@id":"http:\/\/weizn.net\/#website"},"datePublished":"2013-09-06T04:12:18+00:00","dateModified":"2013-09-06T04:12:18+00:00","breadcrumb":{"@id":"http:\/\/weizn.net\/?p=36#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/weizn.net\/?p=36"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/weizn.net\/?p=36#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/weizn.net\/"},{"@type":"ListItem","position":2,"name":"AI\u7248\u4e94\u5b50\u68cb"}]},{"@type":"Article","@id":"http:\/\/weizn.net\/?p=36#article","isPartOf":{"@id":"http:\/\/weizn.net\/?p=36#webpage"},"author":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"headline":"AI\u7248\u4e94\u5b50\u68cb","datePublished":"2013-09-06T04:12:18+00:00","dateModified":"2013-09-06T04:12:18+00:00","mainEntityOfPage":{"@id":"http:\/\/weizn.net\/?p=36#webpage"},"wordCount":1,"commentCount":0,"publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"articleSection":["Java"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/weizn.net\/?p=36#respond"]}]},{"@type":["Person","Organization"],"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264","name":"zinan","logo":{"@id":"http:\/\/weizn.net\/#personlogo"}}]}},"_links":{"self":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=36"}],"version-history":[{"count":0,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/36\/revisions"}],"wp:attachment":[{"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}