New shogi engine: TJshogi

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Dann Corbit, Harvey Williamson

TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

New shogi engine: TJshogi

Post by TonyJH »

I think there are a few people interested in shogi on this message board.

I just released my shogi engine, TJshogi, which uses Tord Romstad's USI protocol. If there's interest in a WinBoard version, I will release it as well.

It is much weaker than the top shogi engines, but it can beat me easily anyway. Feedback is welcome.
DomLeste
Posts: 221
Joined: Thu Mar 09, 2006 4:53 pm

Re: New shogi engine: TJshogi

Post by DomLeste »

Hi how i do install this? I like to use crazyhorse engine but no clue how to use it?
User avatar
hgm
Posts: 27701
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: New shogi engine: TJshogi

Post by hgm »

TonyJH wrote:If there's interest in a WinBoard version, I will release it as well.
I am intersted in a WinBoard version.
Remember the WB protocol commands 'white' and 'black' are used for sente and gote, respectively, but if you think that is confusing, you can switch off sending of the colors altogether by "feature colors=0".
TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

Re: New shogi engine: TJshogi

Post by TonyJH »

DomLeste wrote:Hi how i do install this? I like to use crazyhorse engine but no clue how to use it?
First, you need the GUI (Shogidokoro). If you can't find the download link on the website, which is in Japanese, you could try this direct link.

The Shogidokoro GUI itself is in English (menus are in English, pieces are Japanese). The GUI seems easy to use. To install an engine go to the "Game" menu and then "Engine Manager".
TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

Re: New shogi engine: TJshogi

Post by TonyJH »

hgm wrote: Remember the WB protocol commands 'white' and 'black' are used for sente and gote, respectively, but if you think that is confusing, you can switch off sending of the colors altogether by "feature colors=0".
Ok. I have been using "feature colors=0" anyway.

So far, I have WinBoard support implemented as follows. (Most of the following doesn't apply to the USI version.)

1. WB color convention is used (which is reversed from shogi colors). For example, if sente mates, TJshogi sends: "1-0 {White mates}". If gote mates, TJshogi sends "0-1 {Black mates}".

2. I decided to not try to adjudicate perpetual checks (i.e. sending "1-0 {Perpetual check by Black}"). The GUI should probably be responsible for that.

3. TJshogi uses normal WinBoard coordinates (lower left square is 'a1') rather than normal shogi coordinates (lower left square is '9i').

4. "@" is used instead of "*" for drop moves, e.g. "G@a1".

5. Non-promotion moves are not appended with '='. The GUI shouldn't assume a move is intended to be a promotion unless appended with '+'.

6. setboard works using SFEN. SFEN standard is followed with one exception: 'w' = sente's turn, 'b' = gote's turn, to be consistent with the WB color convention. Actually, I think I should change this to just follow the SFEN standard.

H.G., do you agree with this implementation?
User avatar
hgm
Posts: 27701
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: New shogi engine: TJshogi

Post by hgm »

TonyJH wrote:Ok. I have been using "feature colors=0" anyway.

So far, I have WinBoard support implemented as follows. (Most of the following doesn't apply to the USI version.)

1. WB color convention is used (which is reversed from shogi colors). For example, if sente mates, TJshogi sends: "1-0 {White mates}". If gote mates, TJshogi sends "0-1 {Black mates}".
That is OK. I suppose even in USI 1-0 means "Sente wins". The comment inside the braces can be anything you want to appear in the PGN; it is not interpreted by WinBoard.
2. I decided to not try to adjudicate perpetual checks (i.e. sending "1-0 {Perpetual check by Black}"). The GUI should probably be responsible for that.
I was not even aware of this rule. Can you point me to a place where the Shogi rules for repeats are unambiguously explained?
3. TJshogi uses normal WinBoard coordinates (lower left square is 'a1') rather than normal shogi coordinates (lower left square is '9i').
OK, this makes life easy for WinBoard. Actually WinBoard does have an option -alphaRank that you can use to switch to the Shogi coordinate system, this option was not thought through very well. It enabled me to use GNUShogi as an engine, but I should really diversify it into -firstAlphaRank and -secondAlphaRank to be useful. So far I did not do that, as there was little need for it when only one WB engine existed that could play Shogi.
4. "@" is used instead of "*" for drop moves, e.g. "G@a1".
This is OK, although the WinBoard parser would also understand "G*a1" as a drop move. (In any variant, actually; the parser is variant independent.)
5. Non-promotion moves are not appended with '='. The GUI shouldn't assume a move is intended to be a promotion unless appended with '+'.
This is actually opposite from what the GUI would understand. If nothing is appended to a promotion move, promotion is assumed, similar in spirit to when this happens in Chess, where promotion to Queen is assumed. You need to append the '=' to defer promotion.
6. setboard works using SFEN. SFEN standard is followed with one exception: 'w' = sente's turn, 'b' = gote's turn, to be consistent with the WB color convention. Actually, I think I should change this to just follow the SFEN standard.
Note that WinBoard uses a FEN standard similar to bFEN, where the holdings come immediately after the board, before the side-to-move field. It does enclose the holdings in [], though, so it is easy to unambiguously parse the FEN no matter where the holdings appear amongst the other FEN fields. bFENs do not use digits in the holdings field; if white holds 3 Pawns it simply writes PPP. (Note that capitals always refer to pieces of sente.)
TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

Re: New shogi engine: TJshogi

Post by TonyJH »

hgm wrote:
TonyJH wrote: 2. I decided to not try to adjudicate perpetual checks (i.e. sending "1-0 {Perpetual check by Black}"). The GUI should probably be responsible for that.
I was not even aware of this rule. Can you point me to a place where the Shogi rules for repeats are unambiguously explained?
From Wikipedia:
"If the same game position occurs four (formerly three) times with the same player to play, the game is considered a draw. For two positions to be considered the same, the pieces in hand must be the same as well as the positions on the board. However, if this occurs with one player giving perpetual check, then that player loses."

From computer-shogi.org:
"The position of perpetual repetition is a draw, except that if one side's moves are checks only then that side loses the game. Perpetual repetition is decided by the championship server if the game is under LAN. It is decided by the perpetual repetition decision program after being declared to the CSA by referees, leaders of the teams, program developers, or agents."

Maybe the WB engine should claim win/loss for perpetual check? If not, then the engine would either have to ignore the repetition, or claim draw (which would be wrong).
TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

Re: New shogi engine: TJshogi

Post by TonyJH »

A WinBoard version of TJshogi is now available in addition to the USI version.

Some new changes for the WB version:

1. The engine will claim win/loss from perpetual check, by default. This feature can be turned off by putting this line in TJshogi.ini:
claim_perpetual_check 0
2. For setboard, it uses WinBoard_F type FEN, instead of SFEN.
3. '=' is appended to moves to defer promotion, as expected by WinBoard_F.
User avatar
hgm
Posts: 27701
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: New shogi engine: TJshogi

Post by hgm »

I will work on implementing the rule in WB_F, so you can safely claim the win even with claim testing on. I understand that if only part of the moves are checks, it is draw. E.g. a loop: check / evasion / mate-threat / forced move to evade mate.
User avatar
AdminX
Posts: 6320
Joined: Mon Mar 13, 2006 2:34 pm
Location: Acworth, GA

Re: New shogi engine: TJshogi

Post by AdminX »

Image

Very interesting this "Shogi", Any good websites or books to find out more on it that you recommend? Basic beginnger stuff for now, because I don't have a clue what the pieces are or how they move. It was only my understanding of computers and chess programs that allowed me to install and setup the interface and engines. It would be nice if you could resize the boards in Shogidokoro GUI. I was also able to locate and install a Shogi engine called "SpearCSA". Now as to your program "TJshogi" is there a opening book for it and how do I configure your engine to use it?

Thanks for sharing this ...
"Good decisions come from experience, and experience comes from bad decisions."
__________________________________________________________________
Ted Summers