{"id":26227,"date":"2024-11-24T08:54:01","date_gmt":"2024-11-24T00:54:01","guid":{"rendered":"https:\/\/fwq.ai\/blog\/26227\/"},"modified":"2024-11-24T08:54:01","modified_gmt":"2024-11-24T00:54:01","slug":"%e5%a6%82%e4%bd%95%e7%ae%80%e5%8c%96%e4%ba%94%e5%ad%90%e6%a3%8b%e4%bb%a3%e7%a0%81%e4%b8%ad%e7%9a%84%e9%87%8d%e5%a4%8d%e9%83%a8%e5%88%86%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/26227\/","title":{"rendered":"\u5982\u4f55\u7b80\u5316\u4e94\u5b50\u68cb\u4ee3\u7801\u4e2d\u7684\u91cd\u590d\u90e8\u5206\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173086326481552.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u7b80\u5316\u4e94\u5b50\u68cb\u4ee3\u7801\u4e2d\u7684\u91cd\u590d\u90e8\u5206\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u7b80\u5316\u4e94\u5b50\u68cb\u4ee3\u7801\u4e2d\u7684\u91cd\u590d\u90e8\u5206\uff1f\u63d2\u56fe\" \/><\/p>\n<h3>\u4e94\u5b50\u68cb\u4ee3\u7801\u7b80\u5316<\/h3>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5982\u4f55\u7b80\u5316\u4e94\u5b50\u68cb\u4ee3\u7801\u4e2d\u91cd\u590d\u7684\u90e8\u5206\uff1f<\/p>\n<p><strong>\u95ee\u9898\u5185\u5bb9\uff1a<\/strong><\/p>\n<p>\u63d0\u4f9b\u4e86\u7f16\u5199\u7684\u4e94\u5b50\u68cb\u4ee3\u7801\uff0c\u4f46\u5176\u4e2d\u6709\u591a\u4e2a\u91cd\u590d\u7684\u90e8\u5206\u3002\u5e0c\u671b\u5f97\u5230\u4e00\u4e2a\u66f4\u7b80\u5316\u7684\u4ee3\u7801\u7248\u672c\u3002<\/p>\n<p><strong>\u95ee\u9898\u7b54\u6848\uff1a<\/strong><\/p>\n<p><strong>\u62c6\u5206\u91cd\u590d\u65b9\u6cd5<\/strong><\/p>\n<p>\u5c06\u5927\u65b9\u6cd5\u4e2d\u7684\u91cd\u590d\u90e8\u5206\u62c6\u5206\u6210\u66f4\u5c0f\u7684\u51fd\u6570\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>placepiece()\uff1a\u653e\u7f6e\u68cb\u5b50<\/li>\n<li>checkandplace()\uff1a\u68c0\u67e5\u67d0\u4e2a\u4f4d\u7f6e\u662f\u5426\u53ef\u653e\u7f6e\u68cb\u5b50\u5e76\u653e\u7f6e<\/li>\n<li> rpoint()\uff1a\u63a7\u5236\u673a\u5668\u4eba\u7684\u884c\u4e3a\uff08\u68c0\u67e5\u8fde\u5b50\u60c5\u51b5\u3001\u963b\u6321\u7528\u6237\u3001\u5c1d\u8bd5\u5f62\u6210\u4e94\u8fde\uff09<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b\u4ee3\u7801\uff1a<\/strong><\/p>\n<pre>\/\/ \u5c01\u88c5\u653e\u7f6e\u68cb\u5b50\u51fd\u6570\nfunction placePiece(x, y) {\n  boxs.value[x][y].place = 2;\n  fourDetial = determineEquare3(4, 2, { x, y, place: 2 });\n  airPlace.push(x * row.value + y);\n}\n\n\/\/ \u5c01\u88c5\u68c0\u67e5\u548c\u653e\u7f6e\u51fd\u6570\nfunction checkAndPlace(x, y) {\n  if (boxs.value[x]?.[y]?.place === 0) {\n    placePiece(x, y);\n    curUser.value = 1;\n    return true;\n  }\n  return false;\n}\n\n\/\/ \u673a\u5668\u4eba\u63a7\u5236\u51fd\u6570\nfunction airPoint() {\n  const directions = [\n    [0, 1],\n    [1, 0],\n    [1, 1],\n    [1, -1],\n  ];\n\n  \/\/ \u5904\u7406\u56db\u8fde\u60c5\u51b5\n  if (!isEmptyObject(fourDetial)) {\n    const { type, geyi, x, y, times } = fourDetial;\n\n    if (geyi) {\n      for (let i = x; i &gt; x - times + 1; i--) {\n        if (checkAndPlace(i, y)) {\n          return;\n        }\n      }\n    } else {\n      for (const [dx, dy] of directions) {\n        const newX = x + dx * times;\n        const newY = y + dy * times;\n\n        if (checkAndPlace(newX, newY)) {\n          return;\n        }\n      }\n    }\n  }\n\n  \/\/ \u5904\u7406\u963b\u6321\u7528\u6237\u60c5\u51b5\n  const temp = determineEquare3();\n  if (temp) {\n    const { type, geyi, x, y, times } = temp;\n\n    if (geyi) {\n      for (let i = x; i &gt; x - times + 1; i--) {\n        if (checkAndPlace(i, y)) {\n          return;\n        }\n      }\n    } else {\n      for (const [dx, dy] of directions) {\n        const newX = x + dx * times;\n        const newY = y + dy * times;\n\n        if (checkAndPlace(newX, newY)) {\n          return;\n        }\n      }\n    }\n  } else {\n    \/\/ \u4f01\u56fe\u5b8c\u6210\u4e94\u8fde\n    airFiveLine();\n  }\n\n  curUser.value = 1;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f18\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u4ee3\u7801\u66f4\u7b80\u6d01\u3001\u6613\u8bfb\u3002<\/li>\n<li>\u91cd\u590d\u90e8\u5206\u88ab\u62c6\u5206\u6210\u53ef\u91cd\u7528\u7684\u5c0f\u51fd\u6570\u3002<\/li>\n<li>\u7ef4\u62a4\u548c\u8c03\u8bd5\u66f4\u65b9\u4fbf\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u7b80\u5316\u4e94\u5b50\u68cb\u4ee3\u7801\u4e2d\u7684\u91cd\u590d\u90e8\u5206\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e94\u5b50\u68cb\u4ee3\u7801\u7b80\u5316 \u95ee\u9898\uff1a \u5982\u4f55\u7b80\u5316\u4e94\u5b50\u68cb\u4ee3\u7801\u4e2d\u91cd\u590d\u7684\u90e8\u5206\uff1f \u95ee\u9898\u5185\u5bb9\uff1a \u63d0\u4f9b\u4e86\u7f16\u5199\u7684\u4e94\u5b50\u68cb\u4ee3\u7801\uff0c\u4f46\u5176\u4e2d\u6709\u591a\u4e2a\u91cd\u590d\u7684\u90e8\u5206\u3002\u5e0c\u671b\u5f97\u5230\u4e00\u4e2a\u66f4\u7b80\u5316\u7684\u4ee3\u7801\u7248\u672c\u3002 \u95ee\u9898\u7b54\u6848\uff1a \u62c6\u5206\u91cd\u590d\u65b9\u6cd5 \u5c06\u5927\u65b9\u6cd5\u4e2d\u7684\u91cd\u590d\u90e8\u5206\u62c6\u5206\u6210\u66f4\u5c0f\u7684\u51fd\u6570\uff0c\u4f8b\u5982\uff1a placepiece()\uff1a\u653e\u7f6e\u68cb\u5b50 checkandplace()\uff1a\u68c0\u67e5\u67d0\u4e2a\u4f4d\u7f6e\u662f\u5426\u53ef\u653e\u7f6e\u68cb\u5b50\u5e76\u653e\u7f6e rpoint()\uff1a\u63a7\u5236\u673a\u5668\u4eba\u7684\u884c\u4e3a\uff08\u68c0\u67e5\u8fde\u5b50\u60c5\u51b5\u3001\u963b\u6321\u7528\u6237\u3001\u5c1d\u8bd5\u5f62\u6210\u4e94\u8fde\uff09 \u793a\u4f8b\u4ee3\u7801\uff1a \/\/ \u5c01\u88c5\u653e\u7f6e\u68cb\u5b50\u51fd\u6570 function placePiece(x, y) { boxs.value[x][y].place = 2; fourDetial = determineEquare3(4, 2, { x, y, place: 2 }); airPlace.push(x * row.value + y); } \/\/ \u5c01\u88c5\u68c0\u67e5\u548c\u653e\u7f6e\u51fd\u6570 function checkAndPlace(x, y) { if (boxs.value[x]?.[y]?.place === 0) { placePiece(x, y); curUser.value = 1; return true; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-26227","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=26227"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26227\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=26227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=26227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=26227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}