{"id":27298,"date":"2024-11-24T10:42:43","date_gmt":"2024-11-24T02:42:43","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27298\/"},"modified":"2024-11-24T10:42:43","modified_gmt":"2024-11-24T02:42:43","slug":"%e5%a6%82%e4%bd%95%e9%80%9a%e8%bf%87%e6%8f%90%e5%8f%96%e9%87%8d%e5%a4%8d%e4%bb%a3%e7%a0%81%e4%b8%ba%e5%b0%8f%e5%87%bd%e6%95%b0%ef%bc%8c%e7%ae%80%e5%8c%96%e4%ba%94%e5%ad%90%e6%a3%8b%e6%9c%ba%e5%99%a8-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27298\/","title":{"rendered":"\u5982\u4f55\u901a\u8fc7\u63d0\u53d6\u91cd\u590d\u4ee3\u7801\u4e3a\u5c0f\u51fd\u6570\uff0c\u7b80\u5316\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u7684\u4ee3\u7801\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173122617697870.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u901a\u8fc7\u63d0\u53d6\u91cd\u590d\u4ee3\u7801\u4e3a\u5c0f\u51fd\u6570\uff0c\u7b80\u5316\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u7684\u4ee3\u7801\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u901a\u8fc7\u63d0\u53d6\u91cd\u590d\u4ee3\u7801\u4e3a\u5c0f\u51fd\u6570\uff0c\u7b80\u5316\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u7684\u4ee3\u7801\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4e94\u5b50\u68cb\u673a\u5668\u4eba,\u7b80\u5316\u4ee3\u7801?<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong>\u5982\u4f55\u7b80\u5316\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u7684\u4ee3\u7801\uff0c\u5c06\u5927\u91cf\u91cd\u590d\u7684\u90e8\u5206\u63d0\u53d6\u6210\u5c0f\u51fd\u6570\u3002<\/p>\n<p><strong>\u7b54\u6848\uff1a<\/strong>\u53ef\u4ee5\u5c06\u4ee3\u7801\u4e2d\u7684\u91cd\u590d\u90e8\u5206\u63d0\u53d6\u6210\u4ee5\u4e0b\u5c0f\u51fd\u6570\uff1a<\/p>\n<ul>\n<li>placePiece(x, y)\uff1a\u653e\u7f6e\u68cb\u5b50<\/li>\n<li>checkAndPlace(x, y)\uff1a\u68c0\u67e5\u4f4d\u7f6e\u662f\u5426\u53ef\u4ee5\u653e\u7f6e\u68cb\u5b50<\/li>\n<li>isEmptyObject(obj)\uff1a\u68c0\u67e5\u5bf9\u8c61\u662f\u5426\u4e3a\u7a7a<\/li>\n<\/ul>\n<p>\u4f7f\u7528\u8fd9\u4e9b\u5c0f\u51fd\u6570\uff0c\u53ef\u4ee5\u5c06 rPoint \u51fd\u6570\u91cd\u5199\u4e3a\uff1a<\/p>\n<pre>function airPoint() {\n  const directions = [\n    [0, 1], [1, 0], [1, 1], [1, -1] \/\/ \u56db\u4e2a\u65b9\u5411\uff1a\u6c34\u5e73\u3001\u5782\u76f4\u3001\u4e24\u4e2a\u5bf9\u89d2\u7ebf\n  ];\n\n  \/\/ \u68c0\u67e5\u662f\u5426\u6709\u56db\u4e2a\u8fde\u5728\u4e00\u8d77\u7684\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  \/\/ \u68c0\u67e5\u662f\u5426\u6709\u963b\u6321\u7528\u6237\u7684\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\u4e2a\u8fde\u7ebf\n    airFiveLine();\n  }\n\n  curUser.value = 1;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u6837\uff0c\u4ee3\u7801\u5c31\u66f4\u52a0\u7b80\u6d01\u548c\u53ef\u8bfb\u4e86\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u901a\u8fc7\u63d0\u53d6\u91cd\u590d\u4ee3\u7801\u4e3a\u5c0f\u51fd\u6570\uff0c\u7b80\u5316\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u7684\u4ee3\u7801\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,\u7b80\u5316\u4ee3\u7801? \u95ee\u9898\uff1a\u5982\u4f55\u7b80\u5316\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u7684\u4ee3\u7801\uff0c\u5c06\u5927\u91cf\u91cd\u590d\u7684\u90e8\u5206\u63d0\u53d6\u6210\u5c0f\u51fd\u6570\u3002 \u7b54\u6848\uff1a\u53ef\u4ee5\u5c06\u4ee3\u7801\u4e2d\u7684\u91cd\u590d\u90e8\u5206\u63d0\u53d6\u6210\u4ee5\u4e0b\u5c0f\u51fd\u6570\uff1a placePiece(x, y)\uff1a\u653e\u7f6e\u68cb\u5b50 checkAndPlace(x, y)\uff1a\u68c0\u67e5\u4f4d\u7f6e\u662f\u5426\u53ef\u4ee5\u653e\u7f6e\u68cb\u5b50 isEmptyObject(obj)\uff1a\u68c0\u67e5\u5bf9\u8c61\u662f\u5426\u4e3a\u7a7a \u4f7f\u7528\u8fd9\u4e9b\u5c0f\u51fd\u6570\uff0c\u53ef\u4ee5\u5c06 rPoint \u51fd\u6570\u91cd\u5199\u4e3a\uff1a function airPoint() { const directions = [ [0, 1], [1, 0], [1, 1], [1, -1] \/\/ \u56db\u4e2a\u65b9\u5411\uff1a\u6c34\u5e73\u3001\u5782\u76f4\u3001\u4e24\u4e2a\u5bf9\u89d2\u7ebf ]; \/\/ \u68c0\u67e5\u662f\u5426\u6709\u56db\u4e2a\u8fde\u5728\u4e00\u8d77\u7684\u60c5\u51b5 if (!isEmptyObject(fourDetial)) { const { type, geyi, x, y, times } = fourDetial; if (geyi) { for (let i = x; i &gt; x [&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-27298","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27298","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=27298"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27298\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}