{"id":3974,"date":"2024-11-10T10:07:40","date_gmt":"2024-11-10T02:07:40","guid":{"rendered":"https:\/\/fwq.ai\/blog\/3974\/"},"modified":"2024-11-10T10:07:40","modified_gmt":"2024-11-10T02:07:40","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%e5%a6%82%e4%bd%95%e7%ae%80%e5%8c%96%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/3974\/","title":{"rendered":"\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u4ee3\u7801\u5982\u4f55\u7b80\u5316\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173120473656723.jpg\" class=\"aligncenter\" title=\"\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u4ee3\u7801\u5982\u4f55\u7b80\u5316\uff1f\u63d2\u56fe\" alt=\"\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u4ee3\u7801\u5982\u4f55\u7b80\u5316\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><\/p>\n<p>\u60a8\u63d0\u5230\u7684\u4ee3\u7801\u4e2d\u6709\u5f88\u591a\u91cd\u590d\u7684\u90e8\u5206\uff0c\u5e0c\u671b\u5f97\u5230\u7b80\u5316\u3002<\/p>\n<p><strong>\u56de\u7b54\uff1a<\/strong><\/p>\n<p>\u5c06\u4ee3\u7801\u4e2d\u91cd\u590d\u7684\u90e8\u5206\u62c6\u5206\u6210\u5c0f\u65b9\u6cd5\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>\/\/ \u5c01\u88c5\u4e00\u4e2a\u51fd\u6570\u7528\u4e8e\u653e\u7f6e\u68cb\u5b50\nfunction placePiece(x, y) {\n  boxs.value[x][y].place = 2;\n  airPlace.push(x * row.value + y);\n  fourDetial = determineEquare3(4, 2, { x, y, place: 2 });\n}\n\n\/\/ \u5c01\u88c5\u4e00\u4e2a\u51fd\u6570\u6765\u68c0\u67e5\u662f\u5426\u6709\u53ef\u653e\u7f6e\u68cb\u5b50\u7684\u4f4d\u7f6e\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}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u4e3b\u51fd\u6570\u4e2d\u4f7f\u7528\u8fd9\u4e9b\u5c0f\u65b9\u6cd5\uff1a<\/p>\n<pre>\/\/ \u68c0\u67e5\u662f\u5426\u6709\u56db\u4e2a\u8fde\u5728\u4e00\u8d77\u7684\u60c5\u51b5\nif (!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}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u4f7f\u4ee3\u7801\u66f4\u6613\u4e8e\u9605\u8bfb\u548c\u7ef4\u62a4\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e94\u5b50\u68cb\u673a\u5668\u4eba\u4ee3\u7801\u5982\u4f55\u7b80\u5316\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 \u60a8\u63d0\u5230\u7684\u4ee3\u7801\u4e2d\u6709\u5f88\u591a\u91cd\u590d\u7684\u90e8\u5206\uff0c\u5e0c\u671b\u5f97\u5230\u7b80\u5316\u3002 \u56de\u7b54\uff1a \u5c06\u4ee3\u7801\u4e2d\u91cd\u590d\u7684\u90e8\u5206\u62c6\u5206\u6210\u5c0f\u65b9\u6cd5\uff0c\u5982\u4e0b\u6240\u793a\uff1a \/\/ \u5c01\u88c5\u4e00\u4e2a\u51fd\u6570\u7528\u4e8e\u653e\u7f6e\u68cb\u5b50 function placePiece(x, y) { boxs.value[x][y].place = 2; airPlace.push(x * row.value + y); fourDetial = determineEquare3(4, 2, { x, y, place: 2 }); } \/\/ \u5c01\u88c5\u4e00\u4e2a\u51fd\u6570\u6765\u68c0\u67e5\u662f\u5426\u6709\u53ef\u653e\u7f6e\u68cb\u5b50\u7684\u4f4d\u7f6e function checkAndPlace(x, y) { if (boxs.value[x]?.[y]?.place === 0) { placePiece(x, y); curUser.value = 1; return true; } return false; } \u767b\u5f55\u540e\u590d\u5236 \u5728\u4e3b\u51fd\u6570\u4e2d\u4f7f\u7528\u8fd9\u4e9b\u5c0f\u65b9\u6cd5\uff1a \/\/ [&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-3974","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3974","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=3974"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3974\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=3974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=3974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=3974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}