kifu records (2016) | 2017-10-12 21:56 |
usiToCsa.rbは、USIプロトコル対応の思考プログラムをshogi-serverと接続するCUIモジュールであり、USIプロトコルとCSAプロトコルとを橋渡しします。本モジュールはサンプル実装であり、shogi-serverの利用に際し、本モジュールの使用を推奨する意図はありません。shogi-serverへは、お好きな方法でご接続ください。また、本モジュールは、コンピュータ将棋選手権等の本番環境での使用実績はありませんので、ご注意ください。なお、「フィッシャーモード」による持ち時間制御には対応していません。
usiToCsa.rb is a sample script translating between the CSA and USI protocols, connecting engines speaking the USI protocol to the Shogi-server. It is just a reference implementation, not a recommended or official way to access to the Shogi-server; you can connect with any programs as you like. Note that it has never been tested with the server that is developed by the Computer Shogi Association and used for the World Computer Shogi Championship. It has yet to support Fischer's clock.
shogi-serverと同様です(GPL)。
Same as the Shogi-server (GPL).
Rubyが必要です。ruby 1.9.3を用いたLinux上での動作を確認しました。Windows上での動作実績はありませんが、修正するにしても比較的軽微な変更で済むと思われます。
Ruby. Tested with ruby 1.9.3 on Linux. Although the author has not tested it on Windows, it would probably work with a little tweaks.
usiToCsa.rb単体では動作せず、shogi-serverのライブラリに依存しています。shogi-server一式をダウンロードしてください。bin/usiToCsa.rbが本体です。
usiToCsa.rb depends on the Shogi-server's modules, requiring the full set of the Shogi-server. bin/usiToCsa.rb is the main script.
コマンドライン・オプションは、$ usiToCsa.rb --helpをご覧ください。各オプションは、環境変数でも指定できますので、次の2行はどちらも同じ動作です。お好きな方法をお選びください。
You can see various command line options by $ usiToCsa.rb --help. As each option can also be set with environment variables, the following two commands are equivalent.
- $ path/to/usiToCsa.rb --host=wdoor.c.u-tokyo.ac.jp --id=my_id --password=my_password --gamename=floodgate-900-0 --hash=12000 --ponder=1 --keep-alive=60 ./my_engine
- $ env HOST=wdoor.c.u-tokyo.ac.jp ID=my_id PASSWORD=my_password GAMENAME=floodgate-900-0 HASH=12000 PONDER=1 KEEP_ALIVE=60 path/to/usiToCsa.rb ./my_engine
連続対局を考慮してusiToCsa.rbを利用するシェルスクリプトです。対局終了後、shogi-serverに再ログインします。
ログインIDは、環境変数IDで指定します。
ログインパスワードの指定方法は2通りあります。環境変数PASSWORDで指定するか、$HOME/.$ID.passwordというファイルをあらかじめ用意しておき、その記載内容を利用する方法とがあります。
usiToCsa利用例は次のようなコマンドになります。
A helper shell script drives game matches without human interruption; it attempts to re-login the server soon after the previous game ends.
Your login ID is set by an environment variable ID.
Two ways are available for specifying your password; an environment variable PASSWORD or a file $HOME/.$ID.password.
本モジュールは、goコマンドにおいて、残り時間を思考エンジンに与えるだけです。思考エンジン側で、その与えられた残り時間等を考慮して、思考時間を制御する(すなわち、思考を終えて指し手を返す)ことが想定されています。
This script just sends the go command with remaining times. Engines are supposed to control their thinking times and send back best moves autonomously.
ここで解説されているようにgo ponderが思考エンジンに送信されます。そのため、(たとえ対戦相手が大長考したとしても)1手分の候補手しか先読みできません。
As described in here, the script sends engines go ponder, meaning that the engine can only ponder with a single move even if the opponent is thinking for a long period of time.