{"id":2211,"date":"2025-10-19T23:49:15","date_gmt":"2025-10-20T03:49:15","guid":{"rendered":"https:\/\/www.a2life.info\/w\/?p=2211"},"modified":"2025-10-26T19:40:52","modified_gmt":"2025-10-26T23:40:52","slug":"500%e4%b8%87%e8%a9%b0%e5%b0%86%e6%a3%8b%e3%81%ae%e7%ad%94%e3%81%88%e3%82%92%e5%b0%86%e6%a3%8b%e3%82%a8%e3%83%b3%e3%82%b8%e3%83%b3%e3%81%a7%e8%a7%a3%e3%81%8f%e3%81%93%e3%81%a8%e3%82%92%e8%a9%a6","status":"publish","type":"post","link":"https:\/\/www.a2life.info\/w\/?p=2211","title":{"rendered":"500\u4e07\u8a70\u5c06\u68cb\u306e\u7b54\u3048\u3092\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\u3067\u89e3\u304f\u3053\u3068\u3092\u8a66\u307f\u308b"},"content":{"rendered":"\n<p>\u3055\u3066<\/p>\n\n\n\n<p>\u81ea\u5206\u306e\u30b5\u30a4\u30c8\u306b\u3084\u306d\u3046\u3089\u304a\u3046\u3055\u3093\u63d0\u4f9b\u306e\uff15\uff10\uff10\u4e07\u5c40\u306e\u8a70\u5c06\u68cb\u5c40\u9762\u3092\u4efb\u610f\u306b\u8868\u793a\u3067\u304d\u308b\u30da\u30fc\u30b8\u3092\u524d\u56de\u4f5c\u6210\u3057\u305f\u308f\u3051\u3060\u304c\u3001\u8a70\u3081\u624b\u9806\u307e\u3067\u306f\u3064\u3044\u3066\u3044\u306a\u3044\u3002\u3000\u3053\u308c\u306f\u3082\u3068\u3082\u3068\u63d0\u4f9b\u3055\u308c\u308b\u5c40\u9762\u306b\u3082\u56de\u7b54\u306f\u6dfb\u4ed8\u3055\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3042\u3063\u3066\u3001\u57fa\u672c\u7684\u306b\u306f\u3058\u3076\u3093\u3067\u89e3\u304f\u304b\uff08\u305d\u308c\u307b\u3069\u96e3\u3057\u3044\u554f\u984c\u306f\u305d\u308c\u307b\u3069\u7121\u3044\uff09\u3055\u3082\u306a\u304f\u3070\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\uff08\u3084\u306d\u3046\u3089\u304a\u3046\u306a\u3069\uff09\u3092\u81ea\u5206\u306e\u30d1\u30bd\u30b3\u30f3\u306b\u5c0e\u5165\u3057\u3066\u5c40\u9762\u3092sfen\u3067\u306f\u308a\u3064\u3051\u3066\u691c\u7d22\u3055\u305b\u308c\u3070\u56de\u7b54\u306f\u5c0e\u3051\u51fa\u305b\u307e\u3059\u3068\u3044\u3046\u4f7f\u3044\u65b9\u304c\u524d\u63d0\u306b\u306a\u3063\u3066\u3044\u308b\u308f\u3051\u3060\u3002<\/p>\n\n\n\n<p>\u81ea\u5206\u306e\u30b5\u30a4\u30c8\u3067\u3082\u30da\u30fc\u30b8\u304b\u3089sfen\u3092\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u8a70\u5c06\u68cb\u304c\u89e3\u3051\u308b\u74b0\u5883\u3092\u81ea\u5206\u306e\u30d1\u30bd\u30b3\u30f3\u4e0a\u306b\u6301\u3063\u3066\u3044\u308c\u3070\u3044\u3044\u3053\u3068\u306b\u306a\u308b\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u524d\u306b\u3082\u66f8\u3044\u305f\u304c\u3001\u30b5\u30a4\u30c8\u306e\u30da\u30fc\u30b8\u4e0a\u3067\u56de\u7b54\u3082\u305d\u306e\u307e\u307e\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308c\u3070\u4fbf\u5229\u306a\u3053\u3068\u306f\u78ba\u304b\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3092\u5b9f\u73fe\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u6700\u521d\u306b\u8003\u3048\u308b\u306e\u306f\u8a70\u5c06\u68cb\u3092\u89e3\u304fAPI\u3092\u7528\u610f\u3057\u3066Web Page\u304b\u3089\u30aa\u30f3\u30c7\u30de\u30f3\u30c9\u305d\u306eAPI\u3092\u53e9\u3051\u306b\u884c\u3051\u3070\u826f\u3044\u3068\u3044\u3046\u65b9\u6cd5\u3002\u3000\u3053\u308c\u306b\u306fAPI\u3092\u4f9b\u7d66\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u304c\u5fc5\u8981\u306b\u306a\u308b\u3002\u3000\u3000\u3059\u3053\u3057\u63a2\u3057\u3066\u307f\u305f\u3089Claude.ai\u95a2\u9023\u306eMCP\u30b5\u30fc\u30d0\u30fc\u306e\u5b9f\u88c5\u3067\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\u3068\u30d6\u30ea\u30c3\u30b8\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u69cb\u7bc9\u3092express\u3092\u4f7f\u3063\u305f\u5f62\u3067\u3059\u3067\u306bGitHub\u306b\u3042\u3052\u3066\u3044\u308b\u65b9\u304c\u3044\u305f\u3002<a href=\"https:\/\/github.com\/azumausu\/shogi-mcp\">azumausu\/shogi-mcp<\/a><\/p>\n\n\n\n<p>\u5b9f\u969b\u306b\u3053\u308c\u3067\u30b5\u30fc\u30d0\u30fc\u3092\u4f5c\u6210\u3057\u3001<a href=\"https:\/\/github.com\/yaneurao\/YaneuraOu\/wiki\/%E3%82%84%E3%81%AD%E3%81%86%E3%82%89%E7%8E%8B%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E6%89%8B%E9%A0%86\">\u3084\u306d\u3046\u3089\u304a\u3046\u3092\u5c0e\u5165\u3057\u3066\u307f\u305f<\/a>\u3089\u3001\u3046\u307e\u304f\u4f5c\u52d5\u3059\u308b\u3053\u3068\u306f\u78ba\u8a8d\u3067\u304d\u305f\u3002\u3000\u3000\u3067\u3082\u3084\u306f\u308a\u3001\u30b5\u30fc\u30d0\u30fc\u3092\u5e38\u306b\u30b9\u30bf\u30f3\u30d0\u30a4\u3055\u305b\u3066\u304a\u304b\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3001\u3068\u3044\u3046\u8ab2\u984c\u306f\u6b8b\u308b\u3057\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u8a70\u307f\u3092\u8fd4\u305b\u308b\u3088\u3046\u306a\u9ad8\u901f\u306e\u30a8\u30f3\u30b8\u30f3\u3092\u52d5\u304b\u3059\u305f\u3081\u306e\u30d0\u30fc\u30c1\u30e3\u30eb\u30de\u30b7\u30f3\u306f\u305d\u308c\u306a\u308a\u306e\u30b9\u30da\u30c3\u30af\u306e\u3082\u306e\u304c\u5fc5\u8981\u306b\u306a\u308b\u3002\u3000\u3000\u3053\u3061\u3089\u306f\u6700\u4f4e\u9650\u306e\u30ea\u30bd\u30fc\u30b9\u3068\u30de\u30b7\u30f3\u30b9\u30da\u30c3\u30af\u3067\u30b5\u30a4\u30c8\u3092\u904b\u55b6\u3059\u308b\u306e\u3092\u65e8\u3068\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u65b9\u91dd\u304c\u305d\u3050\u308f\u306a\u3044\u3002<\/p>\n\n\n\n<p>\u3088\u3063\u3066\u8003\u3048\u65b9\u3092\u5207\u308a\u66ff\u3048\u3001\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3082\u3088\u3044\u306e\u3067\u9000\u8077\u4ee5\u6765\uff13\u5e74\u9593\u7720\u3063\u3066\u3044\u308b\u696d\u52d9\u7528\u306e\u30ce\u30fc\u30c8\u30d1\u30bd\u30b3\u30f3\u3067\u3072\u305f\u3059\u3089\u5c40\u9762\u3092\u89e3\u6790\u3055\u305b\u3066\uff15\uff10\uff10\u4e07\u554f\u306e\u8a70\u3081\u624b\u9806\u3092\u5c0e\u304d\u51fa\u3057\u3001\u3053\u308c\u3092\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u4e0a\u306b\u683c\u7d0d\u3057\u3066\u3053\u3053\u304b\u3089\u7b54\u3048\u3092\u5f15\u304d\u51fa\u3059\u65b9\u91dd\u3067\u9032\u3081\u308b\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3092\u884c\u3046\u305f\u3081\u306b\u306f\u3001\u30ce\u30fc\u30c8\u30d1\u30bd\u30b3\u30f3\u3067\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\u3092\u8d77\u52d5\u3057\u3001\u3053\u308c\u306b\u5c40\u9762\u3092\u9001\u3063\u3066\u3001\u8a70\u307f\u306e\u56de\u7b54\u3092\u8aad\u307f\u53d6\u308b\u3053\u3068\u3092\u5ef6\u3005\u3068\u7e70\u308a\u8fd4\u3059\u3068\u3044\u3046\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u5fc5\u8981\u306b\u306a\u308b\u3002<\/p>\n\n\n\n<p>\u306a\u306e\u3067\u3001\u4ee5\u4e0bPython\u306e\u304a\u52c9\u5f37\u306e\u7d9a\u304d\u3092\u3059\u308b\u3053\u3068\u306b\u306a\u3063\u305f\u308f\u3051\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u5c06\u68cb\u306eEngine\u3068\u901a\u4fe1\u3059\u308b\u90e8\u5206\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u69cb\u6210\u3067\u8003\u3048\u308b\u3002<\/p>\n\n\n\n<p>\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\uff08\u3084\u306d\u3046\u3089\u304a\u3046\uff09\u3092\u30b5\u30d6\u30d7\u30ed\u30bb\u30b9\u3067\u8d77\u52d5\u3059\u308b\u3002<br>\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u306bstdio\u3092\u901a\u3058\u3066\u8a70\u5c06\u68cb\u3092\u89e3\u3044\u3066\u306d\u3001\u3068\u3044\u3046\u30b3\u30de\u30f3\u30c9\u3092\u9001\u308a\u3000\u7b54\u3048\u3092\u3044\u305f\u3060\u304f\u3002<br>\u3053\u308c\u3092\u554f\u984c\u306e\u6570\u3060\u3051\u7e70\u308a\u8fd4\u3059\u3002<br>\u3059\u3079\u3066\u7d42\u308f\u3063\u305f\u3089\u30b5\u30d6\u30d7\u30ed\u30bb\u30b9\u3092\u7d42\u4e86<\/p>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u3053\u306e\u30a8\u30f3\u30b8\u30f3\u3092\u8d77\u52d5\u3055\u305b\u305f\u3042\u3068\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u8a70\u5c06\u68cb\u3092\u89e3\u304f\u305f\u3081\u306b\u306f\u3001<br>\u307e\u305a &#8220;usi&#8221; \u30b3\u30de\u30f3\u30c9\u3092\u9001\u3063\u3066\u3001&#8221;usiok&#8221;\u304c\u623b\u3063\u3066\u304f\u308b\u306e\u3092\u307e\u3063\u3066USI\u30d7\u30ed\u30c8\u30b3\u30eb\u304c\u50cd\u304f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3001\u305d\u306e\u306e\u3061\u3000setoption name xxx value yyy\u3068\u3044\u3046\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u30aa\u30d7\u30b7\u30e7\u30f3\u985e\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u304c\u7d42\u308f\u3063\u305f\u3089\u3001\u4ee5\u4e0b\u306e\u30d7\u30ed\u30bb\u30b9\u3092\u554f\u984c\u306e\u6570\u3060\u3051\u7e70\u308a\u8fd4\u3059\u3002<br>\u201disready&#8221;\u3092\u9001\u3063\u3066\u30a8\u30f3\u30b8\u30f3\u306e\u5c40\u9762\u3092\u521d\u671f\u5316\u201dreadyok&#8221;\u3068\u8fd4\u3063\u3066\u304f\u308b\u306e\u3092\u5f85\u3064\u3002<br>&#8220;position sfen  sfen\u6587\u5b57\u5217&#8221; \u3068\u9001\u3063\u3066\u5c40\u9762\u3092\u901a\u9054\u3002<br>&#8220;go mate&#8221;\u3000\u3067\u8a70\u307f\u691c\u7d22\u3092\u958b\u59cb\u3002<br>stdout\u306b\u8fd4\u3055\u308c\u3066\u304f\u308binfo\u6587\u5b57\u5217\u3092\u8aad\u307f\u89e3\u304d\u3053\u306e\u4e2d\u306b mate xx (xx \u306f\u4f8b\u3048\u3070\uff11\uff11\u624b\u8a70\u3081\u306a\u3089\u307011) \u3000\u3068\u3044\u3046\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u308c\u3070\u3001\u6240\u5b9a\u624b\u6570\u306e\u8a70\u307f\u3092\u898b\u3064\u3051\u305f\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u3000&#8221;stop&#8221;\u30b3\u30de\u30f3\u30c9\u3092\u9001\u4fe1\u3057\u3066\u691c\u8a0e\u3092\u30b9\u30c8\u30c3\u30d7\u3055\u305b\u3001\u6587\u5b57\u5217\u306e\u4e2d\u304b\u3089\u8a70\u3081\u624b\u9806\u3060\u3051\u629c\u304d\u51fa\u3057\u3066\u89aa\u30d7\u30ed\u30bb\u30b9\u306b\u8fd4\u3059\u3002\u3000\uff08\u89aa\u30d7\u30ed\u30bb\u30b9\u3067\u753b\u9762\u8868\u793a\u3059\u308b\u306a\u308a\u30d5\u30a1\u30a4\u30eb\u306b\u30bb\u30fc\u30d6\u3059\u308b\u306a\u308a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u66f8\u304d\u8fbc\u3080\u306a\u308a\u306e\u51e6\u7406\u3092\u3059\u308b\uff09<\/p>\n\n\n\n<p>\u3059\u3079\u3066\u7d42\u4e86\u3057\u305f\u3089\u30b5\u30d6\u30d7\u30ed\u30bb\u30b9\u3092\u7d42\u4e86\u3057\u30b9\u30af\u30ea\u30d7\u30c8\u3082\u7d42\u4e86<\/p>\n\n\n\n<p>\u3068\u3044\u3046\u3053\u3068\u3060\u3068\u601d\u3046\u306e\u3067\u3001\u3053\u306e\u8003\u3048\u3092\u3082\u3068\u306b\u5b9f\u969b\u306b\u66f8\u3044\u3066\u307f\u307e\u3057\u305f<\/p>\n\n\n\n<pre title=\"helper - getMateString\" class=\"wp-block-code has-light-gray-color has-dark-gray-background-color has-text-color has-background has-link-color wp-elements-59e2c58404bbbbba1d04ba2a53c67686\" style=\"font-size:15px\"><code lang=\"python\" class=\"language-python line-numbers\">import re\ndef getMateString(line,mateLength):\n    \"\"\"\n    Take string and expected mate length. return True if mate in  equal to or less than the expected length\n    :param line: string to be evaluated for \"mate nn\" substring\n    :param mateLength: expected mate length\n    :return: True if mate in  equal to or less than the expected length. None otherwise\n    \"\"\"\n    pattern = r\"mate\\s(\\d+)\\s\"\n    matches=re.findall(pattern,line)\n\n    if matches:\n        if int(matches[0])&lt;=mateLength:\n            return matches[0]\n    else:\n        return None\n<\/code><\/pre>\n\n\n\n<p>\u30d8\u30eb\u30d1\u30fcFunction\u3000\u305d\u306e\uff11\u3002\u3000\u8a70\u3081\u305f\u3088\u3001\u3068\u3044\u3046\u6587\u5b57\u5217\u304c\u6240\u5b9a\u624b\u6570\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u306e\u78ba\u8a8d\u300211\u624b\u8a70\u3081\u306e\u306f\u305a\u306e\u8a70\u3081\u3060\u306813\u624b\u3068\u304b17\u624b\u306e\u8a70\u3081\u306e\u89e3\u7b54\u304c\u6700\u521d\u623b\u3063\u3066\u304f\u308b\u306e\u3067\u305d\u308c\u3092\u7121\u8996\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3002\u3000\u305f\u3060\u3057\u300111\u624b\u8a70\u3081\u306e\u306f\u305a\u306a\u306b9\u624b\u3068\u304b7\u624b\u3067\u8a70\u307f\u307e\u3059\u3001\u3068\u3044\u3063\u3066\u304f\u308b\u3053\u3068\u304c\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u3063\u305f\u306e\u3067\u6240\u5b9a\u624b\u6570\u4ee5\u4e0b\u306e\u6587\u5b57\u5217\u306b\u3064\u3044\u3066\u3082\u6b63\u89e3\u3068\u5224\u65ad\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n\n\n\n<pre title=\"Start\uff3fEngine\" class=\"wp-block-code has-light-gray-color has-dark-gray-background-color has-text-color has-background has-link-color wp-elements-88c9a5226923683eaa583dafe2eb9bdd\"><code lang=\"python\" class=\"language-python line-numbers\">import subprocess\ndef start_engine(binaryExecutable, options):\n    \"\"\"\n    Executes the shogi engine binary and returns the subprocess object.\n    If log is True, writes standard I\/O streams to log.txt and err.txt.\n    \n    :param binaryExecutable: path to shogi engine\n    :param options: options passed to shogi engine\n    :return: subprocess object\n    \"\"\"\n    try:\n            proc= subprocess.Popen([binaryExecutable], stdin=subprocess.PIPE, stdout=subprocess.PIPE,\n                                universal_newlines=True)\n            # Send 'usi' command and wait until 'usiok' is received\n            proc.stdin.write(\"usi\\n\")\n            proc.stdin.flush()\n\n            while True:\n                line = proc.stdout.readline().strip()\n                if line == \"usiok\":\n                    break\n\n\n            for key, value in options.items():\n                proc.stdin.write('setoption name %s value %s\\n' % (key, value))\n                proc.stdin.flush()\n            return proc\n\n    except Exception as e:\n            print(f\"Error executing engine: {e}\")\n            return None\n<\/code><\/pre>\n\n\n\n<p style=\"font-size:15px\">start_engine\u3068\u3044\u3046\u95a2\u6570\u306f\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\u3092subProcess\u3067\u8d77\u52d5\u3057\u3001option\u8a2d\u5b9a\u3092\u7d42\u3048\u305f\u306e\u3061\u306b\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30e1\u30a4\u30f3\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u8fd4\u3059\u3002`<\/p>\n\n\n\n<p>\u3061\u306a\u307f\u306bEngine\u3068Options\u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u3092\u30e1\u30a4\u30f3\u306b\u3066\u5b9a\u7fa9\u3059\u308b\u3002\u975e\u529b\u306a\u30ce\u30fc\u30c8\u30d1\u30bd\u30b3\u30f3\u3067\u8d70\u3089\u305b\u308b\u306e\u3067Thread\u3092\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\uff14\u304b\u3089\uff12\u306b\u3057\u306a\u3044\u3068\u30a8\u30f3\u30b8\u30f3\u304c\u56fa\u307e\u308b\u3053\u3068\u304c\u3042\u3063\u305f\u3002FV_SCALE\u306f\u6c34\u5320\u306e\u63a8\u5968\u5024\u3002\u5b9a\u8de1\u30d5\u30a1\u30a4\u30eb\u306f\u5fc5\u8981\u306a\u3044\u306e\u3067no_book\u3092\u6307\u5b9a<\/p>\n\n\n\n<pre title=\"engine and options\" class=\"wp-block-code has-light-gray-color has-black-background-color has-text-color has-background has-link-color wp-elements-4fff57fb9010d983c0a5b2d6f388a506\"><code lang=\"python\" class=\"language-python line-numbers\">\n    executable = \".\/engine\/engine\"\n    options = {\"BookFile\": \"no_book\", \"FV_Scale\": \"24\", \"Threads\": \"2\"}<\/code><\/pre>\n\n\n\n<p>\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3067\u30a8\u30f3\u30b8\u30f3\u304c\u52d5\u3044\u3066\u3044\u308b\u306e\u3067\u3001stdin\/stdout\u306e\u30d1\u30a4\u30d7\u3092\u4f7f\u3063\u3066\u4ea4\u4fe1\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3002<\/p>\n\n\n\n<p>Send_command\u95a2\u6570\u3067SFEN\u306e\u5c40\u9762\u3092\u30a8\u30f3\u30b8\u30f3\u306b\u6e21\u3057\u56de\u7b54\u3092\u5f97\u308b\u306e\u3060\u304c\u3001\u305d\u306e\u305f\u3081\u306e\u30d8\u30eb\u30d1\u30fc\u95a2\u6570\u3092\u7528\u610f\u3059\u308b<\/p>\n\n\n\n<pre title=\"initialize and try_mate_again\" class=\"wp-block-code has-light-gray-color has-dark-gray-background-color has-text-color has-background has-link-color wp-elements-4eb07a234536502fa0a71e6f160d9360\"><code lang=\"python\" class=\"language-python line-numbers\">def initialize_engine(proc):\n    \"\"\"\n    send stop then 'isready' to initialize the engine for next command. Will block if \"readyok\" is not returned\n\n    It is assumed 'readyok' response is guaranteed after sending \"isready\" command. Otherwise, the function will hung\n\n    :param proc: chile process object\n    :return: None\n    \"\"\"\n    proc.stdin.write(\"stop\\n\")\n    proc.stdin.flush()\n    proc.stdin.write(\"isready\\n\")\n    proc.stdin.flush()\n    while True:\n        line = proc.stdout.readline()\n        if line == 'readyok\\n':\n            break\ndef try_mate_again(proc):\n    \"\"\"\n    stop engine and try mate eval again.\n    :param proc: child process object\n    :return: None\n    \"\"\"\n\n    proc.stdin.write(\"stop\\n\")\n    proc.stdin.flush()\n    proc.stdin.write(\"go mate\\n\")\n    proc.stdin.flush()\n\ndef query_mate(proc,sfenString,mateLength):\n   \u3000proc.stdin.write(f\"position sfen {sfenString}\\n\")\n     proc.stdin.flush()\n     proc.stdin.write(f\"go mate {mateLength}\\n\")\n     proc.stdin.flush()\n\n<\/code><\/pre>\n\n\n\n<p>initialize_engine\u95a2\u6570\u3067\u306fstop\u3092\u9001\u3063\u3066\u63a2\u7d22\u3092\u7d42\u4e86\u3055\u305b\u305f\u306e\u3061\u3001isready\u3092\u9001\u3063\u3066\u5c40\u9762\u5024\u3092\u521d\u671f\u5316\u3059\u308b\u3002\u3000\u3000try_mate_again\u3067\u306fisready\u3092\u9001\u3089\u305a\u3001go mate\u3092\u9001\u308b\u306e\u3067\u3001\u305d\u306e\u3068\u304d\u30e1\u30e2\u30ea\u30fc\u4e0a\u306b\u3042\u308b\u5c40\u9762\u3092\u6539\u3081\u3066\u63a2\u7d22\u3057\u3066\u8a70\u307f\u3092\u63a2\u3059\u3002<br>query_mate\u95a2\u6570\u306fsfen\u6587\u5b57\u5217\u3092position\u3068\u3057\u3066\u30bb\u30c3\u30c8\u3057\u3001go mate\u3092\u9001\u3063\u3066\u8a70\u307f\u306e\u63a2\u7d22\u958b\u59cb\u3059\u308b\u305f\u3081\u306e\u3082\u306e<\/p>\n\n\n\n<p>send_commands\u306f\u3053\u308c\u3089\u306e\u30d8\u30eb\u30d1\u30fc\u3092\u4f7f\u3044\u306a\u304c\u3089\u8a70\u307f\u3092\u691c\u7d22\u3002<\/p>\n\n\n\n<pre title=\"send_command\" class=\"wp-block-code has-light-gray-color has-dark-gray-background-color has-text-color has-background has-link-color wp-elements-6e0f00cadecd264b19a4f771fc1d78c4\"><code lang=\"python\" class=\"language-python line-numbers\">import os\ndef send_commands(proc, sfenString, mateLength, problemNumber=0):\n    \"\"\"\n    Sends commands to the running shogi engine.\n\n    :param proc: child process object\n    :param sfenString: sfen string to send to shogi engine\n    :param mateLength: length of mate\n    :param problemNumber: optional problem number. Shogi Engine does not need it. this is used to identify the problem number for logging purpose.\n    :return: String for mating move\n    \"\"\"\n\n    try:\n\n        # Send 'isready' command and wait for 'readyok' response\n\n        initialize_engine(proc)\n\n\n        # Send 'position sfen' command and wait for 'info mate' response\n\n        timeout=20\n        line=\"\"\n        time_limit =time.time()+timeout\n        retryCount=50\n        query_mate(proc, sfenString, mateLength)\n        count=0\n        os.set_blocking(proc.stdout.fileno(), False) #make stdout\/in no blocking\n        while True:\n            line = proc.stdout.readline().strip()\n            if line:\n                if getMateString(line, mateLength):\n                    if count &gt; 0:\n                        with open(\"log.txt\", \"a\") as log:\n                            log.write(f\"retry attempted #{count} times at problem #{problemNumber}\\n\")\n                    break\n\n            else:\n                #if stdout is blank, check for timeout condition\n                if time.time() &gt; time_limit:\n                    if count &lt; retryCount:\n                        #if timeout happened and retry count is not maxed, attempt a retry\n                        count += 1\n                        swipe_print(f\"time limit reached, retrying {count} :\")\n\n                        time_limit = time.time() + timeout\n                        # initialize_engine(proc)\n                        # query_mate(proc, sfenString, mateLength)\n                        try_mate_again(proc)\n                    else:\n                        swipe_print(f\"time limit reached, giving up. Problem number: {problemNumber}\")\n                        with open('exception.txt', 'a') as f:\n                            f.write(f\"Giving up. Use the second best solution for problem id: {problemNumber}.\\n\")\n                        break\n\n        os.set_blocking(proc.stdout.fileno(), True) #change back I\/O to blocking mode\n        proc.stdin.write(\"stop\\n\")\n        proc.stdin.flush()\n        return line.split(\"pv \")[-1].strip()\n<\/code><\/pre>\n\n\n\n<p>swipe_print\u306f\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u3001\u753b\u9762\u304c\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u306a\u3044\u3088\u3046\u306b\u540c\u3058\u884c\u306b\u51fa\u529b\u3092\u91cd\u306d\u3066\u3044\u304f\u30d8\u30eb\u30d1\u30fc\u95a2\u6570<\/p>\n\n\n\n<pre title=\"swipte_print\" class=\"wp-block-code has-light-gray-color has-dark-gray-background-color has-text-color has-background has-link-color wp-elements-4ec542c4781cb551f2e5d41d464a04d7\"><code lang=\"python\" class=\"language-python line-numbers\">\ndef swipe_print(text):\n    print(\"\\r\", end=\"\")\n    print(text, end='')\n<\/code><\/pre>\n\n\n\n<p>\u3067\u3001send_command\u3092\uff15\uff10\uff10\u4e07\u56de\u7e70\u308a\u8fd4\u305b\u3070\u3059\u3079\u3066\u306e\u89e3\u7b54\u304c\u5f97\u3089\u308c\u308b\u306f\u305a<\/p>\n\n\n\n<p>stop_engine\u95a2\u6570\u3067\u30a8\u30f3\u30b8\u30f3\u3092\u7d42\u4e86\u3057\u30b5\u30d6\u30d7\u30ed\u30bb\u30b9\u3092\u7d42\u4e86\u3002proc.communicate\u306f\u30d7\u30ed\u30bb\u30b9\u306e\u7d42\u4e86\u51e6\u7406\u3082\u884c\u3063\u3066\u304f\u308c\u308b\u3002<\/p>\n\n\n\n<pre title=\"stop_engine\" class=\"wp-block-code has-light-gray-color has-dark-gray-background-color has-text-color has-background has-link-color wp-elements-878de0840bdea596e8ac175fd551a4fe\"><code lang=\"python\" class=\"language-python line-numbers\">def stop_engine(proc):\n    \"\"\"\n    Stops the running shogi engine.\n    \"\"\"\n    stdout, stderr = proc.communicate(input=\"quit\\n\", timeout=5)\n    if stderr:\n        raise Exception(stderr.decode(\"utf8\"))\n\n    print(\"Engine stopped\")\n\n      \n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>\u3067\u3001\u4e0b\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306f\u4e0a\u306e\u95a2\u6570\u3092\u9069\u5b9c\u306b\u547c\u3073\u51fa\u3057\u3066\u3001mate11.sfen\u306e\u6700\u521d\u306e500\u884c\u3092\u89e3\u3044\u3066\u307f\u3066\u3044\u308b\u3002\u3000\u305d\u306e\u7d50\u679c\u3092\u307f\u306a\u304c\u3089\u3001\u4e0a\u306esend_command\u306e\u4e2d\u8eab\u306f\u4f55\u5ea6\u304b\u4fee\u6b63\u3057\u3066\u3044\u308b\u3002\u3000<\/p>\n\n\n\n<pre title=\"\u30c1\u30a7\u30c3\u30af\u30d7\u30ed\u30b0\u30e9\u30e0\" class=\"wp-block-code has-light-gray-color has-dark-gray-background-color has-text-color has-background has-link-color wp-elements-b8a2369ef66d496a0f65d14ddb6d7665\"><code lang=\"python\" class=\"language-python line-numbers\">\u3000\u3000'''\n    Test program\n    '''\n\n    from swipe_print import swipe_print\n\n\n    # Execute the engine with logging\n    start_time = time.time()\n\n    executable = \".\/engine\/engine\"\n    options = {\"BookFile\": \"no_book\", \"FV_Scale\": \"24\", \"Threads\": \"2\"}\n\n\n    proc = start_engine(executable, options)\n\n    if proc:\n        print(\"Engine executed successfully.\")\n\n\n\n    #soliving problem in text file (first 500 problems)\n    N=500\n    with open(\"mate11.sfen\",\"r\") as f:\n        sfens=f.readlines()[:N]\n        for index, sfen in enumerate(sfens):\n            pv=send_commands(proc, sfen, 11,index)\n            if pv:\n\n                swipe_print(f\"problem#:{index}\\tPrincipal variation: {pv}\")\n\n    # Stop the engine\n    stop_engine(proc)\n    print (f\"Time elapsed: {time.time()-start_time}\")<\/code><\/pre>\n\n\n\n<p>\u3044\u3064\u307e\u3067\u5f85\u3063\u3066\u3082\u6240\u5b9a\u624b\u6570\u306e\u8a70\u307f\u304c\u898b\u3064\u3051\u3089\u308c\u306a\u3044\u3001\u3068\u3044\u3046\u53ef\u80fd\u6027\u3082\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u3063\u305f\u306e\u3067\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3092\u8a2d\u3051\u308b\u3053\u3068\u306b\u3057\u305f\u3002\u3000\u6700\u521d\u306fThreading\u3067\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3092\u751f\u3058\u3055\u305b\u3001\u3053\u306e\u3068\u304dKeyboardInterrupt\u3092\u751f\u6210\u3057\u3066\u3053\u308c\u3092\u51e6\u7406\u3059\u308b\u624b\u6cd5\u3092\u8a66\u3057\u3066\u307f\u305f\u304cCTL-C\u304c\u4e57\u3063\u53d6\u3089\u308c\u308b\u306e\u304c\u3069\u3046\u3082\u6c17\u306b\u98df\u308f\u306a\u3044\u3002\u3000async.io\u30e9\u30a4\u30d6\u30e9\u30ea\u30fc\u3082\u8aad\u3093\u3067\u307f\u305f\u304c\u30d6\u30ed\u30c3\u30afIO\u3068\u3069\u306e\u3088\u3046\u306b\u6574\u5408\u3055\u305b\u3066\u3088\u3044\u306e\u304b\u304c\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u3002\u3000\u306e\u3067\u6700\u521d\u306f\u3069\u308d\u304f\u3055\u304fWhile\u30eb\u30fc\u30d7\u306e\u4e2d\u3067\u6642\u9593\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u4e00\u5b9a\u6642\u9593\u305f\u3063\u3066\u3044\u305f\u3089break\u3059\u308b\u3068\u3044\u3046\u7c21\u5358\u306a\u65b9\u6cd5\u3067\u66f8\u3044\u3066\u307f\u305f\u3002\u3000\u305f\u3060\u3057\u3001\u3053\u308c\u30dd\u30fc\u30ea\u30f3\u30b0\u3067\u6642\u9593\u3092\u898b\u3066\u3044\u308b\u3060\u3051\u306a\u306e\u3067\u3001\u30eb\u30fc\u30d7\u4e2d\u306estdout.readline()\u304c\u30d6\u30ed\u30c3\u30af\u3057\u3066\u3044\u308b\u9650\u308a\u6642\u9593\u5207\u308c\u306b\u306f\u306a\u3089\u306a\u3044\u3002\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\uff11\uff15\u79d2\u304f\u3089\u3044\u307e\u3067\u306a\u3089\u3001\u3060\u3089\u3060\u3089\u3068\u6587\u5b57\u5217\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u306a\u306e\u3067\u3068\u308a\u3042\u3048\u305a\u30cf\u30f3\u30b0\u3059\u308b\u3053\u3068\u306f\u306a\u3044\u3068\u305f\u304b\u3092\u304f\u304f\u3063\u3066\u66f8\u3044\u3066\u307f\u305f\u3089\u554f\u984c\u306a\u304f\u52d5\u3044\u3066\u3044\u308b\u3002\u3000\u3053\u308c\u3067\u826f\u3057\u306b\u3057\u3088\u3046\u3068\u601d\u3063\u3066\u3044\u305f\u304c\u3001\u3055\u3089\u306b\u65e5\u3092\u7f6e\u3044\u3066\u8abf\u3079\u3066\u307f\u305f\u3089\u3001os.set_blocking\u3068\u3044\u3046\u95a2\u6570\u3092\u898b\u3064\u3051\u305f\u3002Linux\u306e\u307f\u306b\u5bfe\u5fdc\u304b\u3068\u601d\u3063\u305f\u3089\u3001Windows\u306epipe\u306b\u3082Python3.12\u304b\u3089\u5bfe\u5fdc\u3057\u307e\u3057\u305f\u3001\u3068\u306a\u3063\u3066\u3044\u3066\u3001\u3053\u308c\u306f\u30e9\u30c3\u30ad\u30fc\u3002\u3000\u3053\u308c\u3092\u3064\u304b\u3046\u3068stdio\u304c\u30d6\u30ed\u30c3\u30af\u3055\u308c\u306a\u304f\u306a\u308a\u3001readline()\u3067\u4f55\u3082\u306a\u3044\u3068\u304d\u306b\u306f\u7a7a\u306e\u6587\u5b57\u5217\u304c\u8fd4\u3063\u3066\u304f\u308b\u3088\u3046\u306b\u306a\u308b\u306e\u3067\u3001Timeout\u3082\u5272\u308a\u8fbc\u307f\u306a\u3069\u306e\u51e6\u7406\u3092\u4f7f\u3046\u3053\u3068\u306a\u304f\u691c\u77e5\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002\u3000\u307e\u305f\u3001\u30a8\u30f3\u30b8\u30f3\u3001\u691c\u8a0e\u9014\u4e2d\u3067\u30c9\u30c4\u30dc\u306b\u306f\u307e\u3063\u3066\u6b63\u89e3\u304c\u306a\u304b\u306a\u304b\u51fa\u305b\u306a\u304f\u306a\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u3082\u8d77\u3053\u308b\u3068\u3044\u3046\u3053\u3068\u3092\u7d4c\u9a13\u7684\u306b\u77e5\u3063\u305f\u3002\u3053\u306e\u5834\u5408\u306f\u51fa\u529b\u3092\u5f85\u3064\u3088\u308a\u3082\u4e00\u5ea6\u3054\u7834\u7b97\u306b\u3057\u3066\u89e3\u7b54\u3092\u805e\u304d\u76f4\u3059\u3068\u3059\u3050\u306b\u6b63\u89e3\u306b\u305f\u3069\u308a\u7740\u304f\u3088\u3046\u306a\u73fe\u8c61\u304c\u591a\u304f\u307f\u3089\u308c\u305f\u3002\uff08\u5b9f\u306b\u4eba\u9593\u306e\u3088\u3046\u3067\u3042\u308b\uff09\u306e\u3067\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3092\u3084\u305f\u3089\u9577\u304f\u3059\u308b\u3088\u308a\u3001\u30ea\u30c8\u30e9\u30a4\u3068\u7d44\u307f\u5408\u308f\u305b\u305f\u307b\u3046\u304c\u52b9\u7387\u304c\u826f\u3044\u3068\u8003\u3048\u30ea\u30c8\u30e9\u30a4\u3082\u8ffd\u52a0\u3002\u305f\u3044\u3066\u3044\uff12\u56de\u304b\uff13\u56de\u306e\u30ea\u30c8\u30e9\u30a4\u3067\u6b63\u89e3\u306b\u305f\u3069\u308a\u7740\u304f\u3088\u3046\u3060\u304c\u3001\u4e2d\u306b\u306f\uff13\uff10\u56de\u76ee\uff14\uff10\u56de\u76ee\u306e\u30ea\u30c8\u30e9\u30a4\u3067\u6b63\u89e3\u3001\u3068\u3044\u3046\u30b1\u30fc\u30b9\u3082\uff15\uff10\uff10\u554f\u4e2d\uff12\u554f\u3084\uff13\u554f\u767a\u751f\u3057\u3001\u305d\u308c\u3067\u3082\u6b63\u89e3\u306b\u305f\u3069\u308a\u7740\u304b\u306a\u304b\u3063\u305f\u5834\u5408\u306f\u3042\u304d\u3089\u3081\u3066\u3001\u6700\u5f8c\u306b\u8aad\u3093\u3060\u6587\u5b57\u5217\u3092\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u305f\u3002\u4f55\u56de\u304b\u8a66\u3057\u3066\u307f\u305f\u304c\u3001\u8a66\u3059\u3054\u3068\u306b\u30a8\u30f3\u30b8\u30f3\u304c\u30c9\u30c4\u30dc\u306b\u306f\u307e\u308b\u554f\u984c\u306b\u306f\u3001\u3042\u308b\u7a0b\u5ea6\u306e\u4e00\u8cab\u6027\u306f\u3042\u308b\u3082\u306e\u306e\u3001\u524d\u56de\uff13\uff10\u56de\u4ee5\u4e0a\u30ea\u30c8\u30e9\u30a4\u3057\u305f\u554f\u984c\u304c\u6b21\u306eRun\u3067\u306f\u6700\u521d\u306e\u30c8\u30e9\u30a4\u3067\u89e3\u7b54\u304c\u3067\u3066\u304d\u305f\u308a\u3001\u3053\u306e\u3042\u305f\u308a\u306e\u30e9\u30f3\u30c0\u30e0\u6027\u306f\u4e0d\u601d\u8b70\u3060\u306a\u3042\u3068\u601d\u3046\u306e\u3067\u3042\u308b\u3002\u3053\u306e\u8a2d\u5b9a\u306b\u3088\u308b\uff15\uff10\uff10\u554f\uff11\uff11\u624b\u8a70\u3081\u306e\u63a2\u7d22\u3067\u3001\u5168\u554f\u306b11\u624b\u306e\uff08\u307e\u305f\u306f\u305d\u308c\u4ee5\u4e0b\uff09\u8a70\u3081\u624b\u9806\u304c\u8fd4\u3055\u308c\u3066\u304f\u308b\u306e\u306f\u30bf\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3092\uff11\uff15\u79d2\u4ee5\u4e0a\u3001\u30ea\u30c8\u30e9\u30a4\u56de\u6570\u3092\uff15\uff10\u56de\u30de\u30c3\u30af\u30b9\u304f\u3089\u3044\u306b\u3059\u308c\u3070\u3088\u3055\u305d\u3046\u3060\u3002\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3092\u3082\u3063\u3068\u9577\u304f\u3059\u308c\u3070\u78ba\u5b9f\u6027\u306f\u5897\u3057\u305d\u3046\u3060\u304c\u3001\u5168\u90e8\u306e\u554f\u984c\u3092\u89e3\u304f\u6642\u9593\u304c\u3069\u3093\u3069\u3093\u9577\u304f\u306a\u308b\u3002\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u51fa\u529b\u3092\u898b\u3066\u3044\u308b\u3068\u3001\uff19\u5272\u4ee5\u4e0a\u306e\u554f\u984c\u306f\uff12\uff0c\uff13\u79d2\u3067\u6307\u5b9a\u624b\u6570\u306e\u6b63\u89e3\u304c\u51fa\u3066\u3057\u307e\u3046\u306e\u3067\u3042\u308b\u304c\u3001\u3064\u307e\u305a\u3044\u3066\u30ea\u30c8\u30e9\u30a4\u304c\uff13\uff10\u56de\u767a\u751f\u3059\u308b\u554f\u984c\u306f\u89e3\u304f\u306e\u306b\uff11\uff10\u5206\u304b\u304b\u3063\u3066\u3057\u307e\u3046\u3068\u3044\u3046\u3053\u3068\u3067\u3042\u308b\u3002\u307e\u305f\u30ea\u30c8\u30e9\u30a4\u7121\u3057\u306b\u3059\u308c\u3070\u5168\u554f\u306b\u304b\u304b\u308b\u6642\u9593\u306f\u5c11\u306a\u304f\u306a\u308b\u304c\u4e0d\u5b8c\u5168\u306a\uff08\uff11\uff13\u624b\u8a70\u3081\u4ee5\u4e0a\u306e\uff09\u89e3\u7b54\u304c\u5897\u3048\u3066\u304f\u308b\u3002\u3068\u308a\u3042\u3048\u305a\u6642\u9593\u7bc0\u7d04\u306e\u305f\u3081\u3001\u5168\u90e8\u89e3\u304b\u305b\u305f\u3042\u3068\u3067\u3001\uff11\uff11\u624b\u8a70\u3081\u306b\u306a\u3063\u3066\u3044\u306a\u3044\u554f\u984c\u3092\u3042\u3068\u304b\u3089\u518d\u5ea6\u691c\u7d22\u3055\u305b\u308b\u65b9\u6cd5\u3082\u8003\u3048\u305f\u304c\u3001\uff12\u5ea6\u624b\u9593\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3082\u5168\u554f\u6307\u5b9a\u624b\u6570\u306e\u89e3\u7b54\u307e\u3067\u305f\u3069\u308a\u7740\u304f\u65b9\u5411\u3067\u8003\u3048\u308b\u3053\u3068\u306b\u3057\u305f\u306e\u3060\u304c\u3001\u3000\u3053\u306e\u5b9f\u9a13\u7d50\u679c\u304b\u3089\u8a66\u7b97\u3059\u308b\u3068\uff11\uff11\u624b\u8a70\u3081\u306e\u554f\u984c100\u4e07\u500b\u3059\u3079\u3066\u306b11\u624b\u4ee5\u4e0b\u306e\u8a70\u307f\u3092\u307f\u3064\u3051\u308b\u306e\u306b\u306f\u6700\u4f4e\uff12\u304b\u6708\u306f\u304b\u304b\u308a\u305d\u3046\u3060\u3002\u3000\u3061\u306a\u307f\u306b3\u624b\u8a70\u3081\u306e\u307b\u3046\u306f\u30ea\u30c8\u30e9\u30a4\u306a\u3069\u306f\u3055\u3059\u304c\u306b\u767a\u751f\u3057\u3066\u3057\u306a\u3044\u306e\u3067\uff14\u65e5\u307b\u3069\u3067\u7d42\u308f\u308a\u305d\u3046\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<p>\u306a\u306b\u305b\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u7528\uff12\u30b3\u30a2\uff14\u30b9\u30ec\u30c3\u30c9\u306e\u30b9\u30ab\u30a4\u30ec\u30fc\u30af\u3068\u3044\u3046\u975e\u529b\u306aCPU\u306e\u4e0a\u306bRAM\u3082\uff18\u30ae\u30ac\u30d0\u30a4\u30c8\u3067\u3042\u308b\u3002\u9045\u3044\u306e\u306f\u81f4\u3057\u65b9\u304c\u306a\u3044\u3002\u6539\u3081\u3066\uff15\uff10\uff10\u4e07\u554f\u3068\u3044\u3046\u6570\u5b57\u306e\u7406\u4e0d\u5c3d\u3055\u3092\u3057\u307f\u3058\u307f\u611f\u3058\u3066\u3057\u307e\u3046\u3068\u540c\u6642\u306bCPU\u306e\u6027\u80fd\u306e\u3061\u304c\u3044\u304c\u9855\u8457\u306b\u898b\u3048\u3066\u304f\u308b\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u30d1\u30ef\u30fc\u306e\u4f7f\u3044\u305f\u304a\u3057\u65b9\u306f\u51c4\u3044\u306a\u3042\u3068\u601d\u3046\u3002<\/p>\n\n\n\n<p>\u3068\u306b\u304b\u304f\u3001mysql\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u51fa\u529b\u3055\u308c\u305f\u6587\u5b57\u5217\u3092\u66f8\u304d\u8fbc\u3080\u30d1\u30a4\u30bd\u30f3\u30b9\u30af\u30ea\u30d7\u30c8\u3082\u5225\u9014\u4f5c\u6210\u3057\u3001\u4e0a\u8a18\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3001\uff15\uff10\uff10\u4e07\u554f\u3092\uff13\u624b\u8a70\u3081\u304b\u3089\u9806\u756a\u306b\u306a\u3081\u3066\u3044\u304f\u30e1\u30a4\u30f3\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8d77\u52d5\u3055\u305b\u305f\u306e\u304c\u4e09\u65e5\u524d\u3002\u753b\u9762\u3092\u30d6\u30e9\u30f3\u30af\u306b\u3057\u3001\u3072\u3063\u305d\u308a\u305f\u305f\u305a\u3080\u30ce\u30fc\u30c8\u30d1\u30bd\u30b3\u30f3\u3002\u3000\u3068\u304d\u304a\u308a\u3001\u753b\u9762\u3092\u958b\u3044\u3066\u306f\u30b3\u30f3\u30bd\u30fc\u30eb\u4e0a\u306b\u51fa\u3066\u304f\u308b\u554f\u984c\u756a\u53f7\u3092\u898b\u3066\u9032\u884c\u72b6\u6cc1\u3092\u78ba\u8a8d\u3057\u3066\u304a\u308a\u307e\u3059\u3002\u3000\u3046\u3093\u3046\u3093\u3001\u307e\u3060\uff13\u624b\u8a70\u306e\u3042\u305f\u308a\u306f\u9806\u8abf\u3060\u304c\u9053\u306f\u9577\u3044\u3002\uff08\u9577\u3059\u304e\u308b\uff01\uff09<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066 \u81ea\u5206\u306e\u30b5\u30a4\u30c8\u306b\u3084\u306d\u3046\u3089\u304a\u3046\u3055\u3093\u63d0\u4f9b\u306e\uff15\uff10\uff10\u4e07\u5c40\u306e\u8a70\u5c06\u68cb\u5c40\u9762\u3092\u4efb\u610f\u306b\u8868\u793a\u3067\u304d\u308b\u30da\u30fc\u30b8\u3092\u524d\u56de\u4f5c\u6210\u3057\u305f\u308f\u3051\u3060\u304c\u3001\u8a70\u3081\u624b\u9806\u307e\u3067\u306f\u3064\u3044\u3066\u3044\u306a\u3044\u3002\u3000\u3053\u308c\u306f\u3082\u3068\u3082\u3068\u63d0\u4f9b\u3055\u308c\u308b\u5c40\u9762\u306b\u3082\u56de\u7b54\u306f\u6dfb\u4ed8\u3055\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3042\u3063\u3066\u3001\u57fa\u672c\u7684\u306b\u306f\u3058\u3076\u3093\u3067\u89e3\u304f\u304b\uff08\u305d\u308c\u307b\u3069\u96e3\u3057\u3044\u554f\u984c\u306f\u305d\u308c\u307b\u3069\u7121\u3044\uff09\u3055\u3082\u306a\u304f\u3070\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\uff08\u3084\u306d\u3046\u3089\u304a\u3046\u306a\u3069\uff09\u3092\u81ea\u5206\u306e\u30d1\u30bd\u30b3\u30f3\u306b\u5c0e\u5165\u3057\u3066\u5c40\u9762\u3092sfen\u3067\u306f\u308a\u3064\u3051\u3066\u691c\u7d22\u3055\u305b\u308c\u3070\u56de\u7b54\u306f\u5c0e\u3051\u51fa\u305b\u307e\u3059\u3068\u3044\u3046\u4f7f\u3044\u65b9\u304c\u524d\u63d0\u306b\u306a\u3063\u3066\u3044\u308b\u308f\u3051\u3060\u3002 \u81ea\u5206\u306e\u30b5\u30a4\u30c8\u3067\u3082\u30da\u30fc\u30b8\u304b\u3089sfen\u3092\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u8a70\u5c06\u68cb\u304c\u89e3\u3051\u308b\u74b0\u5883\u3092\u81ea\u5206\u306e\u30d1\u30bd\u30b3\u30f3\u4e0a\u306b\u6301\u3063\u3066\u3044\u308c\u3070\u3044\u3044\u3053\u3068\u306b\u306a\u308b\u3002 \u305f\u3060\u524d\u306b\u3082\u66f8\u3044\u305f\u304c\u3001\u30b5\u30a4\u30c8\u306e\u30da\u30fc\u30b8\u4e0a\u3067\u56de\u7b54\u3082\u305d\u306e\u307e\u307e\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308c\u3070\u4fbf\u5229\u306a\u3053\u3068\u306f\u78ba\u304b\u3067\u3042\u308b\u3002 \u3053\u308c\u3092\u5b9f\u73fe\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u6700\u521d\u306b\u8003\u3048\u308b\u306e\u306f\u8a70\u5c06\u68cb\u3092\u89e3\u304fAPI\u3092\u7528\u610f\u3057\u3066Web Page\u304b\u3089\u30aa\u30f3\u30c7\u30de\u30f3\u30c9\u305d\u306eAPI\u3092\u53e9\u3051\u306b\u884c\u3051\u3070\u826f\u3044\u3068\u3044\u3046\u65b9\u6cd5\u3002\u3000\u3053\u308c\u306b\u306fAPI\u3092\u4f9b\u7d66\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u304c\u5fc5\u8981\u306b\u306a\u308b\u3002\u3000\u3000\u3059\u3053\u3057\u63a2\u3057\u3066\u307f\u305f\u3089Claude.ai\u95a2\u9023\u306eMCP\u30b5\u30fc\u30d0\u30fc\u306e\u5b9f\u88c5\u3067\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\u3068\u30d6\u30ea\u30c3\u30b8\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u69cb\u7bc9\u3092express\u3092\u4f7f\u3063\u305f\u5f62\u3067\u3059\u3067\u306bGitHub\u306b\u3042\u3052\u3066\u3044\u308b\u65b9\u304c\u3044\u305f\u3002azumausu\/shogi-mcp \u5b9f\u969b\u306b\u3053\u308c\u3067\u30b5\u30fc\u30d0\u30fc\u3092\u4f5c\u6210\u3057\u3001\u3084\u306d\u3046\u3089\u304a\u3046\u3092\u5c0e\u5165\u3057\u3066\u307f\u305f\u3089\u3001\u3046\u307e\u304f\u4f5c\u52d5\u3059\u308b\u3053\u3068\u306f\u78ba\u8a8d\u3067\u304d\u305f\u3002\u3000\u3000\u3067\u3082\u3084\u306f\u308a\u3001\u30b5\u30fc\u30d0\u30fc\u3092\u5e38\u306b\u30b9\u30bf\u30f3\u30d0\u30a4\u3055\u305b\u3066\u304a\u304b\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3001\u3068\u3044\u3046\u8ab2\u984c\u306f\u6b8b\u308b\u3057\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u8a70\u307f\u3092\u8fd4\u305b\u308b\u3088\u3046\u306a\u9ad8\u901f\u306e\u30a8\u30f3\u30b8\u30f3\u3092\u52d5\u304b\u3059\u305f\u3081\u306e\u30d0\u30fc\u30c1\u30e3\u30eb\u30de\u30b7\u30f3\u306f\u305d\u308c\u306a\u308a\u306e\u30b9\u30da\u30c3\u30af\u306e\u3082\u306e\u304c\u5fc5\u8981\u306b\u306a\u308b\u3002\u3000\u3000\u3053\u3061\u3089\u306f\u6700\u4f4e\u9650\u306e\u30ea\u30bd\u30fc\u30b9\u3068\u30de\u30b7\u30f3\u30b9\u30da\u30c3\u30af\u3067\u30b5\u30a4\u30c8\u3092\u904b\u55b6\u3059\u308b\u306e\u3092\u65e8\u3068\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u65b9\u91dd\u304c\u305d\u3050\u308f\u306a\u3044\u3002 \u3088\u3063\u3066\u8003\u3048\u65b9\u3092\u5207\u308a\u66ff\u3048\u3001\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3082\u3088\u3044\u306e\u3067\u9000\u8077\u4ee5\u6765\uff13\u5e74\u9593\u7720\u3063\u3066\u3044\u308b\u696d\u52d9\u7528\u306e\u30ce\u30fc\u30c8\u30d1\u30bd\u30b3\u30f3\u3067\u3072\u305f\u3059\u3089\u5c40\u9762\u3092\u89e3\u6790\u3055\u305b\u3066\uff15\uff10\uff10\u4e07\u554f\u306e\u8a70\u3081\u624b\u9806\u3092\u5c0e\u304d\u51fa\u3057\u3001\u3053\u308c\u3092\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u4e0a\u306b\u683c\u7d0d\u3057\u3066\u3053\u3053\u304b\u3089\u7b54\u3048\u3092\u5f15\u304d\u51fa\u3059\u65b9\u91dd\u3067\u9032\u3081\u308b\u3053\u3068\u306b\u3057\u305f\u3002 \u3053\u308c\u3092\u884c\u3046\u305f\u3081\u306b\u306f\u3001\u30ce\u30fc\u30c8\u30d1\u30bd\u30b3\u30f3\u3067\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\u3092\u8d77\u52d5\u3057\u3001\u3053\u308c\u306b\u5c40\u9762\u3092\u9001\u3063\u3066\u3001\u8a70\u307f\u306e\u56de\u7b54\u3092\u8aad\u307f\u53d6\u308b\u3053\u3068\u3092\u5ef6\u3005\u3068\u7e70\u308a\u8fd4\u3059\u3068\u3044\u3046\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u5fc5\u8981\u306b\u306a\u308b\u3002 \u306a\u306e\u3067\u3001\u4ee5\u4e0bPython\u306e\u304a\u52c9\u5f37\u306e\u7d9a\u304d\u3092\u3059\u308b\u3053\u3068\u306b\u306a\u3063\u305f\u308f\u3051\u3067\u3059\u3002 \u5c06\u68cb\u306eEngine\u3068\u901a\u4fe1\u3059\u308b\u90e8\u5206\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u69cb\u6210\u3067\u8003\u3048\u308b\u3002 \u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\uff08\u3084\u306d\u3046\u3089\u304a\u3046\uff09\u3092\u30b5\u30d6\u30d7\u30ed\u30bb\u30b9\u3067\u8d77\u52d5\u3059\u308b\u3002\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u306bstdio\u3092\u901a\u3058\u3066\u8a70\u5c06\u68cb\u3092\u89e3\u3044\u3066\u306d\u3001\u3068\u3044\u3046\u30b3\u30de\u30f3\u30c9\u3092\u9001\u308a\u3000\u7b54\u3048\u3092\u3044\u305f\u3060\u304f\u3002\u3053\u308c\u3092\u554f\u984c\u306e\u6570\u3060\u3051\u7e70\u308a\u8fd4\u3059\u3002\u3059\u3079\u3066\u7d42\u308f\u3063\u305f\u3089\u30b5\u30d6\u30d7\u30ed\u30bb\u30b9\u3092\u7d42\u4e86 \u3061\u306a\u307f\u306b\u3053\u306e\u30a8\u30f3\u30b8\u30f3\u3092\u8d77\u52d5\u3055\u305b\u305f\u3042\u3068\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u8a70\u5c06\u68cb\u3092\u89e3\u304f\u305f\u3081\u306b\u306f\u3001\u307e\u305a &#8220;usi&#8221; \u30b3\u30de\u30f3\u30c9\u3092\u9001\u3063\u3066\u3001&#8221;usiok&#8221;\u304c\u623b\u3063\u3066\u304f\u308b\u306e\u3092\u307e\u3063\u3066USI\u30d7\u30ed\u30c8\u30b3\u30eb\u304c\u50cd\u304f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3001\u305d\u306e\u306e\u3061\u3000setoption name xxx value yyy\u3068\u3044\u3046\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u30aa\u30d7\u30b7\u30e7\u30f3\u985e\u3092\u8a2d\u5b9a\u3059\u308b\u3002 \u3053\u308c\u304c\u7d42\u308f\u3063\u305f\u3089\u3001\u4ee5\u4e0b\u306e\u30d7\u30ed\u30bb\u30b9\u3092\u554f\u984c\u306e\u6570\u3060\u3051\u7e70\u308a\u8fd4\u3059\u3002\u201disready&#8221;\u3092\u9001\u3063\u3066\u30a8\u30f3\u30b8\u30f3\u306e\u5c40\u9762\u3092\u521d\u671f\u5316\u201dreadyok&#8221;\u3068\u8fd4\u3063\u3066\u304f\u308b\u306e\u3092\u5f85\u3064\u3002&#8220;position sfen sfen\u6587\u5b57\u5217&#8221; \u3068\u9001\u3063\u3066\u5c40\u9762\u3092\u901a\u9054\u3002&#8220;go mate&#8221;\u3000\u3067\u8a70\u307f\u691c\u7d22\u3092\u958b\u59cb\u3002stdout\u306b\u8fd4\u3055\u308c\u3066\u304f\u308binfo\u6587\u5b57\u5217\u3092\u8aad\u307f\u89e3\u304d\u3053\u306e\u4e2d\u306b mate xx (xx \u306f\u4f8b\u3048\u3070\uff11\uff11\u624b\u8a70\u3081\u306a\u3089\u307011) \u3000\u3068\u3044\u3046\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u308c\u3070\u3001\u6240\u5b9a\u624b\u6570\u306e\u8a70\u307f\u3092\u898b\u3064\u3051\u305f\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u3000&#8221;stop&#8221;\u30b3\u30de\u30f3\u30c9\u3092\u9001\u4fe1\u3057\u3066\u691c\u8a0e\u3092\u30b9\u30c8\u30c3\u30d7\u3055\u305b\u3001\u6587\u5b57\u5217\u306e\u4e2d\u304b\u3089\u8a70\u3081\u624b\u9806\u3060\u3051\u629c\u304d\u51fa\u3057\u3066\u89aa\u30d7\u30ed\u30bb\u30b9\u306b\u8fd4\u3059\u3002\u3000\uff08\u89aa\u30d7\u30ed\u30bb\u30b9\u3067\u753b\u9762\u8868\u793a\u3059\u308b\u306a\u308a\u30d5\u30a1\u30a4\u30eb\u306b\u30bb\u30fc\u30d6\u3059\u308b\u306a\u308a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u66f8\u304d\u8fbc\u3080\u306a\u308a\u306e\u51e6\u7406\u3092\u3059\u308b\uff09 \u3059\u3079\u3066\u7d42\u4e86\u3057\u305f\u3089\u30b5\u30d6\u30d7\u30ed\u30bb\u30b9\u3092\u7d42\u4e86\u3057\u30b9\u30af\u30ea\u30d7\u30c8\u3082\u7d42\u4e86 \u3068\u3044\u3046\u3053\u3068\u3060\u3068\u601d\u3046\u306e\u3067\u3001\u3053\u306e\u8003\u3048\u3092\u3082\u3068\u306b\u5b9f\u969b\u306b\u66f8\u3044\u3066\u307f\u307e\u3057\u305f \u30d8\u30eb\u30d1\u30fcFunction\u3000\u305d\u306e\uff11\u3002\u3000\u8a70\u3081\u305f\u3088\u3001\u3068\u3044\u3046\u6587\u5b57\u5217\u304c\u6240\u5b9a\u624b\u6570\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u306e\u78ba\u8a8d\u300211\u624b\u8a70\u3081\u306e\u306f\u305a\u306e\u8a70\u3081\u3060\u306813\u624b\u3068\u304b17\u624b\u306e\u8a70\u3081\u306e\u89e3\u7b54\u304c\u6700\u521d\u623b\u3063\u3066\u304f\u308b\u306e\u3067\u305d\u308c\u3092\u7121\u8996\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3002\u3000\u305f\u3060\u3057\u300111\u624b\u8a70\u3081\u306e\u306f\u305a\u306a\u306b9\u624b\u3068\u304b7\u624b\u3067\u8a70\u307f\u307e\u3059\u3001\u3068\u3044\u3063\u3066\u304f\u308b\u3053\u3068\u304c\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u3063\u305f\u306e\u3067\u6240\u5b9a\u624b\u6570\u4ee5\u4e0b\u306e\u6587\u5b57\u5217\u306b\u3064\u3044\u3066\u3082\u6b63\u89e3\u3068\u5224\u65ad\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u3002 start_engine\u3068\u3044\u3046\u95a2\u6570\u306f\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\u3092subProcess\u3067\u8d77\u52d5\u3057\u3001option\u8a2d\u5b9a\u3092\u7d42\u3048\u305f\u306e\u3061\u306b\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30e1\u30a4\u30f3\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u8fd4\u3059\u3002` \u3061\u306a\u307f\u306bEngine\u3068Options\u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u3092\u30e1\u30a4\u30f3\u306b\u3066\u5b9a\u7fa9\u3059\u308b\u3002\u975e\u529b\u306a\u30ce\u30fc\u30c8\u30d1\u30bd\u30b3\u30f3\u3067\u8d70\u3089\u305b\u308b\u306e\u3067Thread\u3092\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\uff14\u304b\u3089\uff12\u306b\u3057\u306a\u3044\u3068\u30a8\u30f3\u30b8\u30f3\u304c\u56fa\u307e\u308b\u3053\u3068\u304c\u3042\u3063\u305f\u3002FV_SCALE\u306f\u6c34\u5320\u306e\u63a8\u5968\u5024\u3002\u5b9a\u8de1\u30d5\u30a1\u30a4\u30eb\u306f\u5fc5\u8981\u306a\u3044\u306e\u3067no_book\u3092\u6307\u5b9a \u3053\u306e\u30d7\u30ed\u30bb\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3067\u30a8\u30f3\u30b8\u30f3\u304c\u52d5\u3044\u3066\u3044\u308b\u306e\u3067\u3001stdin\/stdout\u306e\u30d1\u30a4\u30d7\u3092\u4f7f\u3063\u3066\u4ea4\u4fe1\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3002 Send_command\u95a2\u6570\u3067SFEN\u306e\u5c40\u9762\u3092\u30a8\u30f3\u30b8\u30f3\u306b\u6e21\u3057\u56de\u7b54\u3092\u5f97\u308b\u306e\u3060\u304c\u3001\u305d\u306e\u305f\u3081\u306e\u30d8\u30eb\u30d1\u30fc\u95a2\u6570\u3092\u7528\u610f\u3059\u308b initialize_engine\u95a2\u6570\u3067\u306fstop\u3092\u9001\u3063\u3066\u63a2\u7d22\u3092\u7d42\u4e86\u3055\u305b\u305f\u306e\u3061\u3001isready\u3092\u9001\u3063\u3066\u5c40\u9762\u5024\u3092\u521d\u671f\u5316\u3059\u308b\u3002\u3000\u3000try_mate_again\u3067\u306fisready\u3092\u9001\u3089\u305a\u3001go mate\u3092\u9001\u308b\u306e\u3067\u3001\u305d\u306e\u3068\u304d\u30e1\u30e2\u30ea\u30fc\u4e0a\u306b\u3042\u308b\u5c40\u9762\u3092\u6539\u3081\u3066\u63a2\u7d22\u3057\u3066\u8a70\u307f\u3092\u63a2\u3059\u3002query_mate\u95a2\u6570\u306fsfen\u6587\u5b57\u5217\u3092position\u3068\u3057\u3066\u30bb\u30c3\u30c8\u3057\u3001go mate\u3092\u9001\u3063\u3066\u8a70\u307f\u306e\u63a2\u7d22\u958b\u59cb\u3059\u308b\u305f\u3081\u306e\u3082\u306e send_commands\u306f\u3053\u308c\u3089\u306e\u30d8\u30eb\u30d1\u30fc\u3092\u4f7f\u3044\u306a\u304c\u3089\u8a70\u307f\u3092\u691c\u7d22\u3002 swipe_print\u306f\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u3001\u753b\u9762\u304c\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u306a\u3044\u3088\u3046\u306b\u540c\u3058\u884c\u306b\u51fa\u529b\u3092\u91cd\u306d\u3066\u3044\u304f\u30d8\u30eb\u30d1\u30fc\u95a2\u6570 \u3067\u3001send_command\u3092\uff15\uff10\uff10\u4e07\u56de\u7e70\u308a\u8fd4\u305b\u3070\u3059\u3079\u3066\u306e\u89e3\u7b54\u304c\u5f97\u3089\u308c\u308b\u306f\u305a stop_engine\u95a2\u6570\u3067\u30a8\u30f3\u30b8\u30f3\u3092\u7d42\u4e86\u3057\u30b5\u30d6\u30d7\u30ed\u30bb\u30b9\u3092\u7d42\u4e86\u3002proc.communicate\u306f\u30d7\u30ed\u30bb\u30b9\u306e\u7d42\u4e86\u51e6\u7406\u3082\u884c\u3063\u3066\u304f\u308c\u308b\u3002 \u3067\u3001\u4e0b\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306f\u4e0a\u306e\u95a2\u6570\u3092\u9069\u5b9c\u306b\u547c\u3073\u51fa\u3057\u3066\u3001mate11.sfen\u306e\u6700\u521d\u306e500\u884c\u3092\u89e3\u3044\u3066\u307f\u3066\u3044\u308b\u3002\u3000\u305d\u306e\u7d50\u679c\u3092\u307f\u306a\u304c\u3089\u3001\u4e0a\u306esend_command\u306e\u4e2d\u8eab\u306f\u4f55\u5ea6\u304b\u4fee\u6b63\u3057\u3066\u3044\u308b\u3002\u3000 \u3044\u3064\u307e\u3067\u5f85\u3063\u3066\u3082\u6240\u5b9a\u624b\u6570\u306e\u8a70\u307f\u304c\u898b\u3064\u3051\u3089\u308c\u306a\u3044\u3001\u3068\u3044\u3046\u53ef\u80fd\u6027\u3082\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u3063\u305f\u306e\u3067\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3092\u8a2d\u3051\u308b\u3053\u3068\u306b\u3057\u305f\u3002\u3000\u6700\u521d\u306fThreading\u3067\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3092\u751f\u3058\u3055\u305b\u3001\u3053\u306e\u3068\u304dKeyboardInterrupt\u3092\u751f\u6210\u3057\u3066\u3053\u308c\u3092\u51e6\u7406\u3059\u308b\u624b\u6cd5\u3092\u8a66\u3057\u3066\u307f\u305f\u304cCTL-C\u304c\u4e57\u3063\u53d6\u3089\u308c\u308b\u306e\u304c\u3069\u3046\u3082\u6c17\u306b\u98df\u308f\u306a\u3044\u3002\u3000async.io\u30e9\u30a4\u30d6\u30e9\u30ea\u30fc\u3082\u8aad\u3093\u3067\u307f\u305f\u304c\u30d6\u30ed\u30c3\u30afIO\u3068\u3069\u306e\u3088\u3046\u306b\u6574\u5408\u3055\u305b\u3066\u3088\u3044\u306e\u304b\u304c\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u3002\u3000\u306e\u3067\u6700\u521d\u306f\u3069\u308d\u304f\u3055\u304fWhile\u30eb\u30fc\u30d7\u306e\u4e2d\u3067\u6642\u9593\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u4e00\u5b9a\u6642\u9593\u305f\u3063\u3066\u3044\u305f\u3089break\u3059\u308b\u3068\u3044\u3046\u7c21\u5358\u306a\u65b9\u6cd5\u3067\u66f8\u3044\u3066\u307f\u305f\u3002\u3000\u305f\u3060\u3057\u3001\u3053\u308c\u30dd\u30fc\u30ea\u30f3\u30b0\u3067\u6642\u9593\u3092\u898b\u3066\u3044\u308b\u3060\u3051\u306a\u306e\u3067\u3001\u30eb\u30fc\u30d7\u4e2d\u306estdout.readline()\u304c\u30d6\u30ed\u30c3\u30af\u3057\u3066\u3044\u308b\u9650\u308a\u6642\u9593\u5207\u308c\u306b\u306f\u306a\u3089\u306a\u3044\u3002\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\uff11\uff15\u79d2\u304f\u3089\u3044\u307e\u3067\u306a\u3089\u3001\u3060\u3089\u3060\u3089\u3068\u6587\u5b57\u5217\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u306a\u306e\u3067\u3068\u308a\u3042\u3048\u305a\u30cf\u30f3\u30b0\u3059\u308b\u3053\u3068\u306f\u306a\u3044\u3068\u305f\u304b\u3092\u304f\u304f\u3063\u3066\u66f8\u3044\u3066\u307f\u305f\u3089\u554f\u984c\u306a\u304f\u52d5\u3044\u3066\u3044\u308b\u3002\u3000\u3053\u308c\u3067\u826f\u3057\u306b\u3057\u3088\u3046\u3068\u601d\u3063\u3066\u3044\u305f\u304c\u3001\u3055\u3089\u306b\u65e5\u3092\u7f6e\u3044\u3066\u8abf\u3079\u3066\u307f\u305f\u3089\u3001os.set_blocking\u3068\u3044\u3046\u95a2\u6570\u3092\u898b\u3064\u3051\u305f\u3002Linux\u306e\u307f\u306b\u5bfe\u5fdc\u304b\u3068\u601d\u3063\u305f\u3089\u3001Windows\u306epipe\u306b\u3082Python3.12\u304b\u3089\u5bfe\u5fdc\u3057\u307e\u3057\u305f\u3001\u3068\u306a\u3063\u3066\u3044\u3066\u3001\u3053\u308c\u306f\u30e9\u30c3\u30ad\u30fc\u3002\u3000\u3053\u308c\u3092\u3064\u304b\u3046\u3068stdio\u304c\u30d6\u30ed\u30c3\u30af\u3055\u308c\u306a\u304f\u306a\u308a\u3001readline()\u3067\u4f55\u3082\u306a\u3044\u3068\u304d\u306b\u306f\u7a7a\u306e\u6587\u5b57\u5217\u304c\u8fd4\u3063\u3066\u304f\u308b\u3088\u3046\u306b\u306a\u308b\u306e\u3067\u3001Timeout\u3082\u5272\u308a\u8fbc\u307f\u306a\u3069\u306e\u51e6\u7406\u3092\u4f7f\u3046\u3053\u3068\u306a\u304f\u691c\u77e5\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002\u3000\u307e\u305f\u3001\u30a8\u30f3\u30b8\u30f3\u3001\u691c\u8a0e\u9014\u4e2d\u3067\u30c9\u30c4\u30dc\u306b\u306f\u307e\u3063\u3066\u6b63\u89e3\u304c\u306a\u304b\u306a\u304b\u51fa\u305b\u306a\u304f\u306a\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u3082\u8d77\u3053\u308b\u3068\u3044\u3046\u3053\u3068\u3092\u7d4c\u9a13\u7684\u306b\u77e5\u3063\u305f\u3002\u3053\u306e\u5834\u5408\u306f\u51fa\u529b\u3092\u5f85\u3064\u3088\u308a\u3082\u4e00\u5ea6\u3054\u7834\u7b97\u306b\u3057\u3066\u89e3\u7b54\u3092\u805e\u304d\u76f4\u3059\u3068\u3059\u3050\u306b\u6b63\u89e3\u306b\u305f\u3069\u308a\u7740\u304f\u3088\u3046\u306a\u73fe\u8c61\u304c\u591a\u304f\u307f\u3089\u308c\u305f\u3002\uff08\u5b9f\u306b\u4eba\u9593\u306e\u3088\u3046\u3067\u3042\u308b\uff09\u306e\u3067\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3092\u3084\u305f\u3089\u9577\u304f\u3059\u308b\u3088\u308a\u3001\u30ea\u30c8\u30e9\u30a4\u3068\u7d44\u307f\u5408\u308f\u305b\u305f\u307b\u3046\u304c\u52b9\u7387\u304c\u826f\u3044\u3068\u8003\u3048\u30ea\u30c8\u30e9\u30a4\u3082\u8ffd\u52a0\u3002\u305f\u3044\u3066\u3044\uff12\u56de\u304b\uff13\u56de\u306e\u30ea\u30c8\u30e9\u30a4\u3067\u6b63\u89e3\u306b\u305f\u3069\u308a\u7740\u304f\u3088\u3046\u3060\u304c\u3001\u4e2d\u306b\u306f\uff13\uff10\u56de\u76ee\uff14\uff10\u56de\u76ee\u306e\u30ea\u30c8\u30e9\u30a4\u3067\u6b63\u89e3\u3001\u3068\u3044\u3046\u30b1\u30fc\u30b9\u3082\uff15\uff10\uff10\u554f\u4e2d\uff12\u554f\u3084\uff13\u554f\u767a\u751f\u3057\u3001\u305d\u308c\u3067\u3082\u6b63\u89e3\u306b\u305f\u3069\u308a\u7740\u304b\u306a\u304b\u3063\u305f\u5834\u5408\u306f\u3042\u304d\u3089\u3081\u3066\u3001\u6700\u5f8c\u306b\u8aad\u3093\u3060\u6587\u5b57\u5217\u3092\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u305f\u3002\u4f55\u56de\u304b\u8a66\u3057\u3066\u307f\u305f\u304c\u3001\u8a66\u3059\u3054\u3068\u306b\u30a8\u30f3\u30b8\u30f3\u304c\u30c9\u30c4\u30dc\u306b\u306f\u307e\u308b\u554f\u984c\u306b\u306f\u3001\u3042\u308b\u7a0b\u5ea6\u306e\u4e00\u8cab\u6027\u306f\u3042\u308b\u3082\u306e\u306e\u3001\u524d\u56de\uff13\uff10\u56de\u4ee5\u4e0a\u30ea\u30c8\u30e9\u30a4\u3057\u305f\u554f\u984c\u304c\u6b21\u306eRun\u3067\u306f\u6700\u521d\u306e\u30c8\u30e9\u30a4\u3067\u89e3\u7b54\u304c\u3067\u3066\u304d\u305f\u308a\u3001\u3053\u306e\u3042\u305f\u308a\u306e\u30e9\u30f3\u30c0\u30e0\u6027\u306f\u4e0d\u601d\u8b70\u3060\u306a\u3042\u3068\u601d\u3046\u306e\u3067\u3042\u308b\u3002\u3053\u306e\u8a2d\u5b9a\u306b\u3088\u308b\uff15\uff10\uff10\u554f\uff11\uff11\u624b\u8a70\u3081\u306e\u63a2\u7d22\u3067\u3001\u5168\u554f\u306b11\u624b\u306e\uff08\u307e\u305f\u306f\u305d\u308c\u4ee5\u4e0b\uff09\u8a70\u3081\u624b\u9806\u304c\u8fd4\u3055\u308c\u3066\u304f\u308b\u306e\u306f\u30bf\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3092\uff11\uff15\u79d2\u4ee5\u4e0a\u3001\u30ea\u30c8\u30e9\u30a4\u56de\u6570\u3092\uff15\uff10\u56de\u30de\u30c3\u30af\u30b9\u304f\u3089\u3044\u306b\u3059\u308c\u3070\u3088\u3055\u305d\u3046\u3060\u3002\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3092\u3082\u3063\u3068\u9577\u304f\u3059\u308c\u3070\u78ba\u5b9f\u6027\u306f\u5897\u3057\u305d\u3046\u3060\u304c\u3001\u5168\u90e8\u306e\u554f\u984c\u3092\u89e3\u304f\u6642\u9593\u304c\u3069\u3093\u3069\u3093\u9577\u304f\u306a\u308b\u3002\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u51fa\u529b\u3092\u898b\u3066\u3044\u308b\u3068\u3001\uff19\u5272\u4ee5\u4e0a\u306e\u554f\u984c\u306f\uff12\uff0c\uff13\u79d2\u3067\u6307\u5b9a\u624b\u6570\u306e\u6b63\u89e3\u304c\u51fa\u3066\u3057\u307e\u3046\u306e\u3067\u3042\u308b\u304c\u3001\u3064\u307e\u305a\u3044\u3066\u30ea\u30c8\u30e9\u30a4\u304c\uff13\uff10\u56de\u767a\u751f\u3059\u308b\u554f\u984c\u306f\u89e3\u304f\u306e\u306b\uff11\uff10\u5206\u304b\u304b\u3063\u3066\u3057\u307e\u3046\u3068\u3044\u3046\u3053\u3068\u3067\u3042\u308b\u3002\u307e\u305f\u30ea\u30c8\u30e9\u30a4\u7121\u3057\u306b\u3059\u308c\u3070\u5168\u554f\u306b\u304b\u304b\u308b\u6642\u9593\u306f\u5c11\u306a\u304f\u306a\u308b\u304c\u4e0d\u5b8c\u5168\u306a\uff08\uff11\uff13\u624b\u8a70\u3081\u4ee5\u4e0a\u306e\uff09\u89e3\u7b54\u304c\u5897\u3048\u3066\u304f\u308b\u3002\u3068\u308a\u3042\u3048\u305a\u6642\u9593\u7bc0\u7d04\u306e\u305f\u3081\u3001\u5168\u90e8\u89e3\u304b\u305b\u305f\u3042\u3068\u3067\u3001\uff11\uff11\u624b\u8a70\u3081\u306b\u306a\u3063\u3066\u3044\u306a\u3044\u554f\u984c\u3092\u3042\u3068\u304b\u3089\u518d\u5ea6\u691c\u7d22\u3055\u305b\u308b\u65b9\u6cd5\u3082\u8003\u3048\u305f\u304c\u3001\uff12\u5ea6\u624b\u9593\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3082\u5168\u554f\u6307\u5b9a\u624b\u6570\u306e\u89e3\u7b54\u307e\u3067\u305f\u3069\u308a\u7740\u304f\u65b9\u5411\u3067\u8003\u3048\u308b\u3053\u3068\u306b\u3057\u305f\u306e\u3060\u304c\u3001\u3000\u3053\u306e\u5b9f\u9a13\u7d50\u679c\u304b\u3089\u8a66\u7b97\u3059\u308b\u3068\uff11\uff11\u624b\u8a70\u3081\u306e\u554f\u984c100\u4e07\u500b\u3059\u3079\u3066\u306b11\u624b\u4ee5\u4e0b\u306e\u8a70\u307f\u3092\u307f\u3064\u3051\u308b\u306e\u306b\u306f\u6700\u4f4e\uff12\u304b\u6708\u306f\u304b\u304b\u308a\u305d\u3046\u3060\u3002\u3000\u3061\u306a\u307f\u306b3\u624b\u8a70\u3081\u306e\u307b\u3046\u306f\u30ea\u30c8\u30e9\u30a4\u306a\u3069\u306f\u3055\u3059\u304c\u306b\u767a\u751f\u3057\u3066\u3057\u306a\u3044\u306e\u3067\uff14\u65e5\u307b\u3069\u3067\u7d42\u308f\u308a\u305d\u3046\u3067\u3042\u308b\u3002 \u306a\u306b\u305b\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u7528\uff12\u30b3\u30a2\uff14\u30b9\u30ec\u30c3\u30c9\u306e\u30b9\u30ab\u30a4\u30ec\u30fc\u30af\u3068\u3044\u3046\u975e\u529b\u306aCPU\u306e\u4e0a\u306bRAM\u3082\uff18\u30ae\u30ac\u30d0\u30a4\u30c8\u3067\u3042\u308b\u3002\u9045\u3044\u306e\u306f\u81f4\u3057\u65b9\u304c\u306a\u3044\u3002\u6539\u3081\u3066\uff15\uff10\uff10\u4e07\u554f\u3068\u3044\u3046\u6570\u5b57\u306e\u7406\u4e0d\u5c3d\u3055\u3092\u3057\u307f\u3058\u307f\u611f\u3058\u3066\u3057\u307e\u3046\u3068\u540c\u6642\u306bCPU\u306e\u6027\u80fd\u306e\u3061\u304c\u3044\u304c\u9855\u8457\u306b\u898b\u3048\u3066\u304f\u308b\u5c06\u68cb\u30a8\u30f3\u30b8\u30f3\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u30d1\u30ef\u30fc\u306e\u4f7f\u3044\u305f\u304a\u3057\u65b9\u306f\u51c4\u3044\u306a\u3042\u3068\u601d\u3046\u3002 \u3068\u306b\u304b\u304f\u3001mysql\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u51fa\u529b\u3055\u308c\u305f\u6587\u5b57\u5217\u3092\u66f8\u304d\u8fbc\u3080\u30d1\u30a4\u30bd\u30f3\u30b9\u30af\u30ea\u30d7\u30c8\u3082\u5225\u9014\u4f5c\u6210\u3057\u3001\u4e0a\u8a18\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3001\uff15\uff10\uff10\u4e07\u554f\u3092\uff13\u624b\u8a70\u3081\u304b\u3089\u9806\u756a\u306b\u306a\u3081\u3066\u3044\u304f\u30e1\u30a4\u30f3\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8d77\u52d5\u3055\u305b\u305f\u306e\u304c\u4e09\u65e5\u524d\u3002\u753b\u9762\u3092\u30d6\u30e9\u30f3\u30af\u306b\u3057\u3001\u3072\u3063\u305d\u308a\u305f\u305f\u305a\u3080\u30ce\u30fc\u30c8\u30d1\u30bd\u30b3\u30f3\u3002\u3000\u3068\u304d\u304a\u308a\u3001\u753b\u9762\u3092\u958b\u3044\u3066\u306f\u30b3\u30f3\u30bd\u30fc\u30eb\u4e0a\u306b\u51fa\u3066\u304f\u308b\u554f\u984c\u756a\u53f7\u3092\u898b\u3066\u9032\u884c\u72b6\u6cc1\u3092\u78ba\u8a8d\u3057\u3066\u304a\u308a\u307e\u3059\u3002\u3000\u3046\u3093\u3046\u3093\u3001\u307e\u3060\uff13\u624b\u8a70\u306e\u3042\u305f\u308a\u306f\u9806\u8abf\u3060\u304c\u9053\u306f\u9577\u3044\u3002\uff08\u9577\u3059\u304e\u308b\uff01\uff09<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48,16],"tags":[41],"class_list":["post-2211","post","type-post","status-publish","format-standard","hentry","category-programming","category-16","tag-python"],"_links":{"self":[{"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/posts\/2211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2211"}],"version-history":[{"count":12,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/posts\/2211\/revisions"}],"predecessor-version":[{"id":2230,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/posts\/2211\/revisions\/2230"}],"wp:attachment":[{"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}