How to install Yaneuraou with third party evaluation files/opening books and Gikou2
YaneuraOu installation: Currently the strongest shogi engine is Yaneuraou combined with third party evaluation file/opening book as my rating table suggests. To use them, you have to download various files from different sites and put them in the proper places to make them to work together. This is a complicated and easily mistaken procedure that may lead to unexpected results. While there are some instructions (for instance, by Makoto Takizawa-- elmo developer) written in Japanese, I think it may be useful to write an English instruction for international users. (After I wrote this, I realized that there is an instruction already.)
Here are steps which you have to follow.
(1) Check your operating system: You have to use 64bit OS, Windows/Linux/MacOS with at least 4GB open memory. For Windows, binary exe file is available and the installation procedure is relatively easy.
(2) Installation of interface program: There are two choices Shogidokoro or ShogiGUI. Since ShogiGUI does not seem to work on MacOS, I will write the following instructions based on Shogidokoro. (direct link and download page). It is a binary file for Windows. From Linux and MacOS, one may use it through mono or wine. Here is the directory of Shogidokoro (in Japanese OS, sorry).
One may put YaneuraOu engine or other engines in "Engine" folder. You may create "YaneuraOu" folder under Engine folder, (namely Shogidokoro/Engine/Yaneuraou).
(3) Installation of YaneuraOu engine: For the WindowsOS, binary file is available here. Currently the newest version is YaneuraOu-2017-early_KPPT_V479.zip. After unzipping it, you find many files:
You may choose one of the exe files and move it to Engine/YaneuraOu folder. The fastest one is tournament version. It needs AVX2 instruction set is supported by your CPU. To check if it works, just double-click it. If DOS Window appears, it shows it works otherwise you see some errors. If it does not work check other files in the order sse42 -> sse41 -> sse2 -> nosse. The speed of exe files decrease in this order but they can be used for wider(older) class of CPUs.
Linux/MacOS user needs download source files from github: you need clang++ or g++ compiler to build the binary file. There is a Makefile and you may use make command to obtain the binary. For instance, to obtain the tournament version just type "make tournament". Take a look at the Makefile for other options.
(4) In the Shogidokoro/Engine/YaneuraOu directory, you create "book" and "eval" folders. In book folder, you put opening book files while in eval folder, you put evaluation files.
(5) Installation of evaluation files. There are many evaluation files. I pick some of the strongest ones (RXXXX indicate their elo rating when combined with YaneuraOu)
elmo (R3940) : winner of WCSC27. This evaluation file was used in the paper of AlphaZero
Apery_sdt5 (R4125) -- the strongest evaluation file appeared in STD5
apery-qhapaq (Aperypaq) (R4166?) -- some improvement after Apery_sdt5 (aperypaq.7z)
Each set contains three files, "KK_synthesized.bin", "KKP_synthesized.bin", "KPP_synthesized.bin". These are evaluation files. You may simply put them in "eval" folder. (Note: the file names and the size of each file is exactly the same for each third party distribution. If you want to use some of them, it may be better to create subfolder with name, say, elmo, tanuki and put their three files.)
(6) Installation of opening book files: this step may be skipped if you do not need it. Some of the option currently available is:
Original distribution: YaneouraOu has three types of book files. standard_book.db (default book and created from conventional human Shogi record, it is however slightly outdated), yaneuraou_book3.db (machine generated book file)
Mafu book: highly strategic opening book tuned by human (Mafu). Many software developers use it in the tournament. For instance, zip ball of tanuki_sdt5 contains a version of Mafu book.
These files should be placed in book folder.
(7) Registration of Yaneuraou from the interface. Shogidokoro interface (in English mode with international piece design looks like this.
From Game(G)>Engine Manager.., push the "Add" button to register YaneuraOu exe file. Choose the Yaneuraou and push "Engine Configuration.." button, you have a menu. The default is (in my PC)
As you see, there are many options and they are very tricky too. The options which should be carefully chosen are
Threads: the number of threads you want to use.
Hash: the default value 16 (MB) seems to be too small. To use more than 2M nodes, one should set it to 1024 (MB) -- for the larger nodes you need more (thread number times 256 MB for example)
NetworkDelay, NetworkDelay2 : they are time margine (in the unit of millisecond) to play the game through the network. For the self-play on one PC, they should be set to zero.
EvalDir: put the location of evaluation folder. If three files are put in eval folder, the default value works. If you put them in subfolder, change it where you put.
BookFile: the default is the standard_book.db. If you do not want to use the opening book, choose "no_book". If you install the third party book file, rename them as user_book1.db for instance, and choose it from here.
EnterKingRule: this option gives the behavior of engine when EngerKing. Under the default choice, it declares to win when the counting of the pieces is enough over 27 under CSA rule. With NotEnteringKing option, it does not have any declaration.
BookMoves: number of plies for Yaneuraou to play with opening book. It may be set to larger value for Mafu book where large number of the moves are registered.
BookDepthLimit: Some opening book (for example, elmo) do not work properly if we use the default value (16). If opening book does not function properly, set this value to zero.
ResignValue: with the default value, the engine does not resign until the end. If we set smaller value such as 3000, the program will resign at the evaluation point -3000. With this value, under one percent of the games are expected to be reversed.
DepthLimit/NodesLimit: they set the depth or nodes in the engin search. The default value (0) implies infinity (as long as the time is allowed). If one of them is set to small value, for instance DepthLimit=1, the program becomes very weak. This may be appropriate if you want to play with the program.
After everything is set, push OK button.
(8) That's it! To watch match between some engines or play a game with engine, choose menu Game(G)>Start New Game .. To use two engines to play shogi, check off the Ponder and set Hash value to an apropriate value. By selecting Game(G)>Start new server game (floodgate), you may connect your program with floodgate.
If you want to install the second engine, the easiest one is Gikou 2 (R3794). This can be the first engine since the installation is much simpler and the requirement to the memory is also smaller (2GB free memory). While its rating is a bit far from the top, it is still strong compared with the human and useful for most purposes. In order to install it, go to step (3). Download site is here. For the Windows user, gikou2_win.zip is enough. [For Linux/Mac user, you need also download the source and build the binary from the source. The compilation is also easy if you have g++ compiler. After expanding the zip file, there is Makefile at the root directory. "make release" will build gikou for your system and replace gikou.exe in the Windows distribution by the built file.] Put the folder gikou_win into the Engine folder of Shogidokoro. In this case, you can skip steps (4,5,6) since they are already installed. At step (7), repeat the same procedure of the registration of the engine from Game(G)>Engine Manager.., it gives a menu
This time you have much smaller choice for the setting. The options you you need to set is,
BookFile: the default opening book (book.bin) is Mafu book mentioned above. Gikou comes with other opening books for specific openings.
OwnBook: Check it if you like to use opening book
TInyBook: if you use the dafault BookFile, it should be un-checked as default.
BookMaxPly: the number of plies the engine follow in the opening book (20-50) may be useful.
ByoyomiMargin: This is again the time margin. Except for using it for the match through internet, one may set it to 0.
ResignScore: this is an analog of ResignValue in YaneuraOu.
DepthLimit: This is the same as DepthLimit of YaneuraOu. You may play with Gikou2 with smaller value (say depth =1) if you want to play with weaker engine.
Threads: the number of threads which you want to use.