LoginSignup
4
5

More than 5 years have passed since last update.

USI(Universal Shogi Interface)プロトコルについての実態調査

Last updated at Posted at 2016-01-09

USI(Universal Shogi Interface)プロトコルについて調査してみた。

原案: (リンク切れ)http://www.glaurungchess.com/shogi/usi.html
H.G.Mullerさんのサイトにある原案のコピー: http://hgm.nubati.net/usi.html
デファクト: http://shogidokoro.starfree.jp/usi.html

一応、将棋所にあるものがデファクトとの認識ではあるが、エンジンの中にはまだ対応できていないものも存在する。特にgo mateの挙動についてはだいぶ動作が異なる。

原案では、bestmoveが出力されるまでのinfo score mate で手順を出力させる意図だった模様。

詰め手順がない場合は、bestmoveが出力されるまでの間にinfo score mateの出力がないことで判断。go mate時のbestmoveは必ずしも詰め手順の最初の一手とは限らないということだ。

一方で、将棋所の作者による仕様では、明確にcheckmateという応答で対応させる。これは明確でわかりやすい仕様。

以下、私が調べたエンジン毎の動作。

Laramie

info time 77 nodes 9253 depth 3 score mate +5 seldepth 8 pv G*8f 9f9g 8f8g 9g9h 8g8h
bestmove G*8f

infiniteとしても直にbestmoveが返ってくる。(stopを待っていない。)
詰まない場合はscore mateが出力されずにbestmoveが返ってくる。

TJshogi

info depth 3 score mate 5 time 0 nodes 1557 nps 0 pv G*8f
info depth 3 score mate 5 time 30 nodes 2325 nps 77500 pv G*8f 9f9g 8f8g
info depth 4 score mate 5 time 30 nodes 2599 nps 86600 pv G*8f
info depth 4 score mate 5 time 40 nodes 4031 nps 100700 pv G*8f 9f9g 8f8g 9g9h
info depth 5 score mate 5 time 40 nodes 4900 nps 122500 pv G*8f
info depth 5 score mate 5 time 180 nodes 8305 nps 46100 pv G*8f 9f9g 8f8g 9g9h 8g8h
> stop
bestmove G*8f ponder 9f9g

詰まない場合はscore mateが出力されずにbestmoveが出力される。
詰む場合はscore mateが出力されるが、どれが完全な解かわからない。
最長マッチしたものが解か?
余詰め等考えると単に手数が長いだけでは十分ではない。むしろダメ。
一番短い手数のものを選ぶ必要があるが、過渡状態のものが含まれるので簡単ではない。
mate 5の5が手数だとするならば判別可能。moveの数と一致しているものが正解手順。

gse

info time 1000 depth 3 nodes 63980 nps 63980 score cp -6618 pv G*8g 9f8e
info time 1000 depth 4 nodes 66029 nps 66029 score cp -6642 pv G*8g 9f8e 8g8f 8e9d 8f8e 9d9c
info time 1000 depth 4 nodes 70588 nps 70588 score cp 12994 pv G*8f 9f9g 8f8g 9g9h 8g8h 9h8i
info time 1000 depth 4 nodes 70588 nps 70588 score cp 12994 pv G*8f 9f9g 8f8g 9g9h 8g8h 9h8i
> stop
bestmove G*8f

なんでもbestmoveが返ってくる。
score mateも出ないし、詰んでるのか詰んでないのか判別不可能。
詰んでいるのにわけのわからない手が出力されている。

G*8f 9f9g 8f8g 9g9h 8g8h 9h8i
^^^^

Spear

Spearの作者(Reijer Grimbergen氏)は将棋所の作者と繋がっており、
USIも将棋所の方にあわせてある模様。

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5