{"id":27564,"date":"2024-11-24T14:12:33","date_gmt":"2024-11-24T06:12:33","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27564\/"},"modified":"2024-11-24T14:12:33","modified_gmt":"2024-11-24T06:12:33","slug":"%e4%ba%94%e5%ad%90%e6%a3%8b%e6%9c%ba%e5%99%a8%e4%ba%ba%e4%bb%a3%e7%a0%81%e4%b8%ad%e5%a6%82%e4%bd%95%e7%ae%80%e5%8c%96%e9%87%8d%e5%a4%8d%e7%9a%84%e8%90%bd%e5%ad%90%e9%80%bb%e8%be%91%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27564\/","title":{"rendered":"\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u4ee3\u7801\u4e2d\u5982\u4f55\u7b80\u5316\u91cd\u590d\u7684\u843d\u5b50\u903b\u8f91\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173129095540824.jpg\" class=\"aligncenter\" title=\"\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u4ee3\u7801\u4e2d\u5982\u4f55\u7b80\u5316\u91cd\u590d\u7684\u843d\u5b50\u903b\u8f91\uff1f\u63d2\u56fe\" alt=\"\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u4ee3\u7801\u4e2d\u5982\u4f55\u7b80\u5316\u91cd\u590d\u7684\u843d\u5b50\u903b\u8f91\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4e94\u5b50\u68cb\u673a\u5668\u4eba<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong>\u5982\u4f55\u5728\u4ee3\u7801\u4e2d\u7b80\u5316\u91cd\u590d\u7684\u90e8\u5206\uff1f<\/p>\n<p><strong>\u7b54\u6848\uff1a<\/strong><\/p>\n<pre>\/\/ \u4e3e\u4f8b\uff1a\u7b80\u5316\u673a\u5668\u4eba\u843d\u5b50\u903b\u8f91\n\n\/\/ \u521b\u5efa\u653e\u7f6e\u68cb\u5b50\u7684\u51fd\u6570\nconst placePiece = (x, y) =&gt; {\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\/\/ \u521b\u5efa\u68c0\u67e5\u68cb\u5b50\u653e\u7f6e\u4f4d\u7f6e\u7684\u51fd\u6570\nconst checkAndPlace = (x, y) =&gt; {\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\/\/ \u5728\u539f\u51fd\u6570\u4e2d\u8c03\u7528\u65b0\u51fd\u6570\nfunction airPoint() {\n  \/\/ ...\uff08\u5176\u4ed6\u4ee3\u7801\uff09\n\n  \/\/ \u68c0\u67e5\u662f\u5426\u6709\u56db\u4e2a\u8fde\u5728\u4e00\u8d77\u7684\u60c5\u51b5\n  if (!isEmptyObject(fourDetial)) {\n    \/\/ ...\uff08\u4fee\u6539\u4e3a\u4f7f\u7528 checkAndPlace \u51fd\u6570\uff09\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      \/\/ ...\uff08\u4f7f\u7528 for-of \u5faa\u73af\u6765\u7b80\u5316\u4ee3\u7801\uff09\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  \/\/ ...\uff08\u5176\u4ed6\u4ee3\u7801\uff09\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u901a\u8fc7\u5c06\u91cd\u590d\u7684\u903b\u8f91\u62bd\u8c61\u6210\u53ef\u91cd\u7528\u7684\u51fd\u6570\uff0c\u53ef\u4ee5\u663e\u8457\u5730\u7b80\u5316\u4ee3\u7801\uff0c\u63d0\u9ad8\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u4ee3\u7801\u4e2d\u5982\u4f55\u7b80\u5316\u91cd\u590d\u7684\u843d\u5b50\u903b\u8f91\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\u673a\u5668\u4eba \u95ee\u9898\uff1a\u5982\u4f55\u5728\u4ee3\u7801\u4e2d\u7b80\u5316\u91cd\u590d\u7684\u90e8\u5206\uff1f \u7b54\u6848\uff1a \/\/ \u4e3e\u4f8b\uff1a\u7b80\u5316\u673a\u5668\u4eba\u843d\u5b50\u903b\u8f91 \/\/ \u521b\u5efa\u653e\u7f6e\u68cb\u5b50\u7684\u51fd\u6570 const placePiece = (x, y) =&gt; { boxs.value[x][y].place = 2; fourDetial = determineEquare3(4, 2, { x, y, place: 2 }); airPlace.push(x * row.value + y); }; \/\/ \u521b\u5efa\u68c0\u67e5\u68cb\u5b50\u653e\u7f6e\u4f4d\u7f6e\u7684\u51fd\u6570 const checkAndPlace = (x, y) =&gt; { 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-27564","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27564","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=27564"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27564\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}