komori-n / KomoringHeights

A simple and powerful mate solver for Shogi.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

無駄合判定に関して

Rm7367 opened this issue · comments

環境 / Environment

  • Binary Name: KomoringHeights_main:bf6bd8cc82494e8c50a820c20c5a6f7fb499cdf7 0.5.0 64AVX2
  • OS: Ubuntu 18.04.5 LTS (google colab)
  • CPU: Intel(R) Xeon(R) CPU @ 2.20GHz
  • RAM: 13 GB

説明 / Description

l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P4K2/L5GNL w RGN3Prbsn2p 84
この局面での無駄合判定が最新と旧バージョンで異なる点についてある程度調べました。
●まず第一に、YaneuraOuのバージョンが変わったことで、飛車不成が蹴られていました。
node.hpp:ImmidiateCapture() で使用している pseudo_legal(capture_move)をpseudo_legal_s<true>(capture_move)にすると、
上記局面では三手詰となりました。

浅いところの無駄合に関してinfoで局面等を吐き出すようにして取ったlogは以下のようになります。

usi
id name KomoringHeights_main:bf6bd8cc82494e8c50a820c20c5a6f7fb499cdf7 0.5.0 64AVX2
id author by yaneurao , komori-n
option name Threads type spin default 1 min 1 max 512
option name USI_Hash type spin default 4096 min 1 max 33554432
option name WriteDebugLog type string default
option name GenerateAllLegalMoves type check default false
option name DepthLimit type spin default 0 min 0 max 4000
option name NodesLimit type spin default 0 min 0 max 9223372036854775807
option name PvInterval type spin default 1000 min 0 max 1000000
option name PostSearchCount type spin default 400 min 0 max 9223372036854775807
option name RootIsAndNodeIfChecked type check default true
option name YozumePrintLevel type spin default 0 min 0 max 3
usiok
isready
Options[USI_Hash] = 10240
Options[PostSearchCount] = 400
Options[YozumePrintLevel] = 1

readyok
position l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P4K2/L5GNL w RGN3Prbsn2p 84
go mate infinite
info score cp 0 depth 0 seldepth 0 time 0 nodes 0 nps 0 hashfull 0 currmove pv
info score mate 19 depth 0 seldepth 32 time 42 nodes 24990 nps 595000 hashfull 0 string kProvenState 19 ProvenData{R*5h/19(0)/NSBR}
info PostSearch R*4h: .: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P2rRK2/L5GNL w GN3Pbsn2p 86 # 合駒
info PostSearch 5h4h: R: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P3rK2/L5GNL b RGN3Pbsn2p 87 # 取る(駒は返却)
info PostSearch nomate # 不詰(同じ局面でもこの後は詰、一定しないのは仕様?)
info score mate 19 depth 19 seldepth 34 time 460 nodes 273362 nps 594265 hashfull 0 currmove R*5h pv R*5h G*4h 5h4h+ 3i4h 5g4h+ 3h4h B*6f 4h3h N*4f 4g4f S*4g 3h2h 6f3i+ 2h1h 3i2i 1h2i G*3i 2i1h G*2h
info PostSearch R*5h: .: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P1rR1K2/L5GNL w GN3Pbsn2p 86
info PostSearch 6h5h: R: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P2r1K2/L5GNL b RGN3Pbsn2p 87
info PostSearch mate
info PostSearch 3i4h: .: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P1r1GK2/L6NL w RGN3Pbsn2p 86
info PostSearch 6h4h: G: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P3rK2/L6NL b R2GN3Pbsn2p 87
info PostSearch mate
info PostSearch G*4h: .: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P1r1GK2/L5GNL w RN3Pbsn2p 86
info PostSearch 6h4h: G: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P3rK2/L5GNL b RGN3Pbsn2p 87 # 返却局面は最初と同じ
info PostSearch mate # 詰
info PostSearch R*4h: .: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P1r1RK2/L5GNL w GN3Pbsn2p 86
info PostSearch 6h4h: R: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P3rK2/L5GNL b RGN3Pbsn2p 87 # 返却局面は最初と同じ
info PostSearch mate # 詰
info PostSearch G*5h: .: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P1rG1K2/L5GNL w RN3Pbsn2p 86
info PostSearch 6h5h: G: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P2r1K2/L5GNL b RGN3Pbsn2p 87
info PostSearch mate
info PostSearch N*4h: .: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P1r1NK2/L5GNL w RG3Pbsn2p 86
info PostSearch 6h4h: N: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P3rK2/L5GNL b RGN3Pbsn2p 87 # 返却局面は最初と同じ
info PostSearch mate # 詰
info PostSearch N*5h: .: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P1rN1K2/L5GNL w RG3Pbsn2p 86
info PostSearch 6h5h: N: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P2r1K2/L5GNL b RGN3Pbsn2p 87
info PostSearch mate
info PostSearch P*5h: .: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P1rP1K2/L5GNL w RGN2Pbsn2p 86
info PostSearch 6h5h: P: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P2r1K2/L5GNL b RGN3Pbsn2p 87
info PostSearch mate
info PostSearch R*6h: .: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1PrR2K2/L5GNL w GN3Pbsn2p 86
info PostSearch 7h6h: R: l4gknl/3g2s2/pB2pp1pp/3P5/2P6/4s3P/P3sPPP1/1P1r2K2/L5GNL b RGN3Pbsn2p 87 # 返却局面は最初と同じ
info PostSearch mate # 詰
info string mate_len=3(5)
info score mate 3 depth 0 seldepth 34 time 575 nodes 337497 nps 586951 hashfull 0 string yozume: 1: R*4h, 1: R*5h, 1: R*7h
checkmate R*6h 3h4i 6h5h+

ただし、反転局面
lng5l/2k4p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b RBSN2Prgn3p 84
では三手詰になりません。
(追記)
komoring_heights.cppにもあるpseudo_legal()もpseudo_legal_s()に変更してみましたが、
読み筋は変わるものの、三手詰にはなりませんでした。

usi
id name KomoringHeights_main:bf6bd8cc82494e8c50a820c20c5a6f7fb499cdf7 0.5.0 64AVX2
id author by yaneurao , komori-n
option name Threads type spin default 1 min 1 max 512
option name USI_Hash type spin default 4096 min 1 max 33554432
option name WriteDebugLog type string default
option name GenerateAllLegalMoves type check default false
option name DepthLimit type spin default 0 min 0 max 4000
option name NodesLimit type spin default 0 min 0 max 9223372036854775807
option name PvInterval type spin default 1000 min 0 max 1000000
option name PostSearchCount type spin default 400 min 0 max 9223372036854775807
option name RootIsAndNodeIfChecked type check default true
option name YozumePrintLevel type spin default 0 min 0 max 3
usiok
isready
Options[USI_Hash] = 10240
Options[PostSearchCount] = 400
Options[YozumePrintLevel] = 1

readyok
position lng5l/2k4p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b RBSN2Prgn3p 84
go mate infinite
info score cp 0 depth 0 seldepth 0 time 0 nodes 0 nps 0 hashfull 0 currmove pv
info score mate 21 depth 0 seldepth 27 time 21 nodes 10081 nps 480047 hashfull 0 string kProvenState 19 ProvenData{R*5b/21(0)/NSBR}
info PostSearch N*6b: .: lng5l/2knR2p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Prg3p 86 # 合駒
info PostSearch 5b6b: n: lng5l/2kR3p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87 # 取る(駒は返却)
info PostSearch nomate # 不詰(こちらは一貫して不詰)
info PostSearch R*5b: .: lng5l/2k1rR1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Pgn3p 86
info PostSearch 4b5b: r: lng5l/2k1R2p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87
info PostSearch mate
info PostSearch 7a6b: .: ln6l/2kg1R1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Prgn3p 86
info PostSearch 4b6b: g: ln6l/2kR3p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Pr2gn3p 87
info PostSearch mate
info PostSearch G*6b: .: lng5l/2kg1R1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Prn3p 86
info PostSearch 4b6b: g: lng5l/2kR3p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87 # 返却局面は最初と同じ
info PostSearch nomate # 不詰
info score mate 21 depth 13 seldepth 34 time 475 nodes 262862 nps 553393 hashfull 0 currmove R*4b pv R*4b G*6b 4b6b+ 7a6b 5c6b+ 7b6b B*4d 6b5a S*5b 5a4b 4d5c+ 4b3c G*4d
info PostSearch R*4b: .: lng5l/2k2rRp1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Pgn3p 86
info PostSearch 3b4b: r: lng5l/2k2R1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87
info PostSearch mate
info PostSearch 7a6b: .: ln6l/2kg2Rp1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Prgn3p 86
info PostSearch 3b6b: g: ln6l/2kR3p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Pr2gn3p 87
info PostSearch mate
info PostSearch G*6b: .: lng5l/2kg2Rp1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Prn3p 86
info PostSearch 3b6b: g: lng5l/2kR3p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87 # 返却局面は最初と同じ
info PostSearch nomate # 不詰
info string mate_len=19(2)
info score mate 19 depth 0 seldepth 34 time 710 nodes 388015 nps 546500 hashfull 0 string yozume: 1: R*3b, 1: R*4b, 3: 5b6b, 7: B*4d, 9: S*6a
checkmate R*5b N*6b 5b6b+ 7a6b 5c6b+ 7b6b B*5c 6b7b N*8d 8c8d S*8c 7b8c N*7e 8c7d G*6e 7d8e 8i7g 8e7f 6e6f

古いバージョンだと反転局面でも三手詰です。

usi
id name KomoringHeights_main:6b11b655566935e8bcc04d8c060856c0aee648b8 0.4.1 64AVX2
id author by yaneurao , komori-n
option name Threads type spin default 1 min 1 max 512
option name USI_Hash type spin default 4096 min 1 max 33554432
option name WriteDebugLog type check default false
option name DepthLimit type spin default 0 min 0 max 4000
option name NodesLimit type spin default 0 min 0 max 9223372036854775807
option name PvInterval type spin default 1000 min 0 max 1000000
option name PostSearchCount type spin default 400 min 0 max 9223372036854775807
option name RootIsAndNodeIfChecked type check default true
option name YozumePrintLevel type spin default 2 min 0 max 3
usiok
isready
Options[USI_Hash] = 10240
Options[PostSearchCount] = 400
Options[YozumePrintLevel] = 1

readyok
position lng5l/2k4p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b RBSN2Prgn3p 84
go mate infinite
info score cp 0 depth 0 seldepth 0 time 0 nodes 0 nps 0 hashfull 0 currmove pv
info score mate 19 depth 0 seldepth 30 time 50 nodes 25974 nps 519480 hashfull 0 string kProvenState 19 ProvenData{R*5b/19(0)/NSBR}
info PostSearch R*6b: .: lng5l/2krR2p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Pgn3p 86
info PostSearch 5b6b: r: lng5l/2kR3p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87
info PostSearch nomate
info score mate 19 depth 12 seldepth 33 time 254 nodes 155036 nps 610377 hashfull 0 currmove R*5b pv R*5b R*6b 5b6b+ 7a6b 5c6b+ 7b6b B*4d 6b5a R*3a N*4a G*6a 5a5b
info PostSearch R*5b: .: lng5l/2k1rR1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Pgn3p 86
info PostSearch 4b5b: r: lng5l/2k1R2p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87
info PostSearch mate
info PostSearch 7a6b: .: ln6l/2kg1R1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Prgn3p 86
info PostSearch 4b6b: g: ln6l/2kR3p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Pr2gn3p 87
info PostSearch mate
info PostSearch G*6b: .: lng5l/2kg1R1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Prn3p 86
info PostSearch 4b6b: g: lng5l/2kR3p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87
info PostSearch mate
info PostSearch R*6b: .: lng5l/2kr1R1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Pgn3p 86
info PostSearch 4b6b: r: lng5l/2kR3p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87
info PostSearch mate
info PostSearch G*5b: .: lng5l/2k1gR1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Prn3p 86
info PostSearch 4b5b: g: lng5l/2k1R2p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87
info PostSearch mate
info PostSearch N*6b: .: lng5l/2kn1R1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Prg3p 86
info PostSearch 4b6b: n: lng5l/2kR3p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87
info PostSearch mate
info PostSearch N*5b: .: lng5l/2k1nR1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Prg3p 86
info PostSearch 4b5b: n: lng5l/2k1R2p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87
info PostSearch mate
info PostSearch P*5b: .: lng5l/2k1pR1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Prgn2p 86
info PostSearch 4b5b: p: lng5l/2k1R2p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87
info PostSearch mate
info PostSearch R*4b: .: lng5l/2k2rRp1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L b BSN2Pgn3p 86
info PostSearch 3b4b: r: lng5l/2k2R1p1/1pppS3p/p3S4/6p2/5p3/PP1PP2bP/2S2G3/LNKG4L w BSN2Prgn3p 87
info PostSearch mate
info string mate_len=3(5)
info score mate 3 depth 0 seldepth 41 time 1214 nodes 697810 nps 574802 hashfull 1 string yozume: 1: R*3b, 1: R*5b, 1: R*6b
checkmate R*4b 7b6a 4b5b+