yaneurao / YaneuraOu

YaneuraOu is the World's Strongest Shogi engine(AI player) , WCSC29 1st winner , educational and USI compliant engine.
GNU General Public License v3.0
524 stars 140 forks source link

Mate Engine: nomate when there is a rook on 1st file #122

Closed Tellmarch closed 3 years ago

Tellmarch commented 4 years ago

For all positions I tried, if there is Gote's rook on the 1st file, the engine answers "nomate".

Screenshot from 2020-09-14 15-17-56

make -j8 tournament TARGET_CPU=AVX2 COMPILER=g++ YANEURAOU_EDITION=MATE_ENGINE ENGINE_NAME="tanuki- mate engine"^C

jean@jean-desktop:~/shogi/engines/yengine2/YaneuraOu/source$ ./YaneuraOu-by-gcc usi id name tanuki-mate-engine Material 4.91 64AVX2BMI2 TOURNAMENT id author by yaneurao option name Threads type spin default 4 min 1 max 512 option name USI_Hash type spin default 4096 min 1 max 1048576 option name WriteDebugLog type check default false option name NetworkDelay type spin default 120 min 0 max 10000 option name NetworkDelay2 type spin default 1120 min 0 max 10000 option name MinimumThinkingTime type spin default 2000 min 1000 max 100000 option name SlowMover type spin default 100 min 1 max 1000 option name MaxMovesToDraw type spin default 0 min 0 max 100000 option name DepthLimit type spin default 0 min 0 max 2147483647 option name NodesLimit type spin default 0 min 0 max 9223372036854775807 option name Contempt type spin default 2 min -30000 max 30000 option name ContemptFromBlack type check default false option name EvalDir type string default eval option name MorePreciseMatePv type check default true usiok isready info string USI_Hash Clear begin , Hash size = 4096[MB] info string USI_Hash Clear done. readyok position sfen 4k4/9/4P4/8r/9/9/9/9/9 b Gr2b3g4s4n4l17p 1 go mate infinite info string pn 100000000 dn 0 nodes_searched 0 checkmate nomate go matedebug G*5b 口 口 口 口^玉 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 歩 口 口 口 口 口 口 口 口 口 口 口 口^飛 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 先手 手駒 : 金 , 後手 手駒 : 歩17 香4 桂4 銀4 角2 飛 金3 手番 = 先手 sfen 4k4/9/4P4/8r/9/9/9/9/9 b Gr2b3g4s4n4l17p 1

pn-dn100000000,0 key-gen2086237944,1 口 口 口 口^玉 口 口 口 口 口 口 口 口 金 口 口 口 口 口 口 口 口 歩 口 口 口 口 口 口 口 口 口 口 口 口^飛 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 口 先手 手駒 : , 後手 手駒 : 歩17 香4 桂4 銀4 角2 飛 金3 手番 = 後手 sfen 4k4/4G4/4P4/8r/9/9/9/9/9 w r2b3g4s4n4l17p 2

pn,dn = 1,1 key-gen = 4029583722

yaneurao commented 4 years ago

Maybe it's the effect of the most recent mate engine fix commit. There seems to be a bug about this commit, and Mr.Qhapaq is investigating it now.

ddugovic commented 4 years ago

Also reproducible from YaneuraOu-mate-linux-clang++-evallearn bench 4096 1 3 test.sfen mate with test.sfen, although I haven't figured out how to run this from #123 :

4k4/9/4P4/8r/9/9/9/9/9 b Gr2b3g4s4n4l17p 1
ddugovic commented 4 years ago

I am still curious whether this can be reproduced on all platforms. Pull request #123 is updated to compile for Android, MSYS2, and Linux; and results can be seen at https://github.com/ddugovic/YaneuraOu/runs/1235706415

ddugovic commented 3 years ago

Apparently setting MorePreciseMatePv to false is a workaround?

yaneurao commented 3 years ago

I apologize for the long wait. The cause of this bug was that when magic bitboard was ported from Apery, it didn't handle the effects correctly when ROOK or BISHOP was in SQ_NB. (Apery is probably the same).

It should be fixed in the following commit.

https://github.com/yaneurao/YaneuraOu/commit/ed796e99daff8f4286a2f49c673fe0cd6b152ff5