Using USI Engines with gShogi


Page Last Updated: 24th March 2011

This page is part of the gShogi project.

To use a USI engine you need to download it, install it, check it and then add it to gShogi.
Here are some examples.

Lesserkai - An Example of Adding a USI Engine to gShogi

Lesserkai is an engine that comes with Shogidokoro. Shogidokoro is an excellent Shogi program for windows.
The engine comes as source code that builds OK on Linux.

To use the Lesserkai engine use these commands to download, extract and build it:

wget http://www.geocities.jp/shogidokoro/download/LesserkaiSrc.zip
unzip LesserkaiSrc.zip
cd LesserkaiSrc/Lesserkai
make

Note that if you download the zip with a browser it may be corrupted. Use wget to download it and it should work OK.

Now test it works.

First start the engine:

./Lesserkai

It will wait for input.

Enter the command 'usi' and the engine should respond:

usi
id name Lesserkai 1.3.3
id author Program Writer
option name BookFile type string default public.bin
option name UseBook type check default true
usiok

The 'usiok' response means the engine is working and should be OK to use with gshogi.

Now quit the engine by entering 'quit'.

Next add the engine to gShogi:

    Start gShogi. It's best to start it from a terminal so you can see the output.
    Select options, then engines.
    click on the 'Add' button.
    Navigate to the Lesserkai executable with the path LesserkaiSrc/Lesserkai/Lesserkai
    click the open button

The Engine should now appear in your list of engines.

gshogi engines screenshot

Click OK

Now configure it:

    Click on Options, then players in the menu bar.
    Set the white player to Lesserkai 1.3.3 and click OK.
    Click on Options, then configure engine 1.
    You should see the options that you can set for Lesserkai

gshogi configure screenshot

Note that these options are specific to the Lesserkai engine and will be different for a different USI engine.

Set the options, click OK, then you can start playing the game against the engine.

To add other USI engines you can follow a similar procedure.

gse - gShogi USI Engine

gse is a USI version of the gShogi builtin engine.
It is basically the engine from GNU shogi with a USI wrapper.
It runs on Linux and windows.

Download it from here.

To build it:

cd gse/src
make

Then add the engine into gShogi the same way as for Lesserkai (navigate to gse/src/gse.sh when adding the engine).

GPSshogi

GPSshogi was written by students of the University of Tokyo and won the World Computer Shogi Championships in 2009.

Here are instructions to compile it on Fedora 12. These are based on these instructions.

First download osl from http://gps.tanaka.ecc.u-tokyo.ac.jp/cgi-bin/viewvc.cgi/trunk/osl/.
click on download gnu tarball and save the file.
The file is called osl.tar.gz (3.1MB).

Next download GPSshogi from http://gps.tanaka.ecc.u-tokyo.ac.jp/cgi-bin/viewvc.cgi/trunk/gpsshogi/?root=gpsshogi.
click on download gnu tarball and save the file.
The file is called gpsshogi.tar.gz (23.3MB).

Now build it:

yum install boost boost-devel

tar xfvz osl.tar.gz
tar xfvz gpsshogi.tar.gz
    
cd osl/lib/third_party/tcmalloc-0.93
make
cd -
cd osl/release
make

cd -
cd gpsshogi/release
export BOOST_POSTFIX_MT=-mt 
make

cd -
mv gpsshogi/data osl/

When adding it into gShogi you need to navigate to gpsshogi/release/gpsusi.

TJShogi - An Example of Adding a Windows USI Engine to gShogi Using Wine

Most USI engines are for Windows. Some of them will run in gShogi using Wine.
Here I will use TJShogi as an example.

First install Wine:

yum install wine

Next download the TJShogi engine:

wget http://tonyjh.com/chess/TJshogi.zip
unzip TJshogi.zip

After extracting you should have a file called TJshogi.exe.
Now set up a shell script called tjshogi.sh to run the program using Wine.
It should be placed in the same directory as the TJshogi.exe program and should contain these lines:

#!/bin/sh

# tjshogi.sh - run TJshogi under wine

# change the working directory to the one the program is in
BASEDIR=`dirname $0`
cd $BASEDIR

# run the program with wine
/usr/bin/wine TJshogi.exe

Note that the command to get the script directory uses backticks (not quotes).
Now make it executable:

chmod a+x tjshogi.sh

Test it works by running the shell script.
Type in the 'usi' command.
You should see:

usi
id name TJshogi 0.03
id author Tony Hecker
option name USI_Hash type spin default 32 min 4 max 512
option name USI_Ponder type check default true
usiok

Enter 'quit' to quit the program.

Now add the engine into gShogi the same way as for Lesserkai except that when you add the engine you need to navigate to the tjshogi.sh shell script.

Other Engines

Other Windows USI engines that you can use using Wine are Laramie, Blunder and Bonanza.

To use Blunder and Bonanza under wine you will need to install the windows version of mono.

To do this download mono from http://www.go-mono.com/mono-downloads/download.html.

Then install it using wine:

wine mono-2.6.7-gtksharp-2.12.10-win32-2.exe

NB. You should install version 2.6.7 long term supported version and not the latest stable version 2.10.1.
This works with both Blunder and Bonanza whereas 2.10.1 does not work with Bonanza (when tested on Fedora 14 64 bit).

Laramie

Download the file LaramieV3.zip from http://www4.ocn.ne.jp/~grf/shogi-laramie.html

Blunder

Download the file Blunder-20090509-Binary.zip from http://hp.vector.co.jp/authors/VA039571/blunder/
Note that later versions don't work with Wine.

Bonanza

Bonanza is not a USI engine but can be converted to USI using the U2B program.
Download the file bonanza_v4.1.3.zip from http://www.geocities.jp/bonanza_shogi/
Then download the file u2b.zip from http://www.geocities.jp/shogi_depot/
you need to copy u2b.exe into the same folder as bonanza.exe and point your Wine shell script at u2b.exe.

Valid XHTML 1.1   Valid CSS!

Copyright © 2008-2017 John Cheetham
Hosted by GitHub
Disclaimer