Chess variant tournament: Shatranj

Discussion of computer chess matches and engine tournaments.

Moderator: Ras

User avatar
hgm
Posts: 28454
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

enhorning wrote:If anybody knows of other WB-compatible engines (or if there are newer version of these engines), please let me know.
Well, I already wrote this before, but ChessV plays Shatranj (also the regular release).

I did manage to have HaChu play Shatranj, and although it search only half the depth of Fairy-Max, it still managed two draws (out of two) against it. After I cured the problem that it marched its King to the center at the first opportunity!

I even cured the rule that first repetition = loss.

All I have to do is make a Windows compile. But I must setup Fairy-Max for CCT now, which starts in 20 min.
User avatar
hgm
Posts: 28454
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

I just uploaded a Shatranj-including version of HaChu to

http://hgm.nubati.net/HaChu.exe

It is a very simple engine, lacking almost everything:
* No hash table
* No killer heuristic
* No null move
* No LMR
* No decent QS (just 2 ply capture search)
* No game phase
* No King safety
* No Pawn-structure eval

It has mobility in its eval, though!

Despite all this it regularly trashed humans on the 81Dojo server at Chu Shogi. :lol:
enhorning
Posts: 342
Joined: Wed Jan 05, 2011 10:05 pm

Re: Chess variant tournament: Shatranj

Post by enhorning »

hgm wrote:Well, I already wrote this before, but ChessV plays Shatranj (also the regular release).
Hmm, I tried in the past to get ChessV running under Winboard, and didn't manage to get it to work.
User avatar
hgm
Posts: 28454
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

It should be possible, with proper quoting. Only for variants with quotes in their name (such as Bird's Chess) it is a disaster. For variant names without spaces in them, it should actually be easy, as you don't even need the quoting of the variant name.

If you install it with the Load Engine dialog, doesn't it simply work to point out the ChessV_WinBoard.exe and give Shatranj as engine parameter? I will try it later today.
enhorning
Posts: 342
Joined: Wed Jan 05, 2011 10:05 pm

Re: Chess variant tournament: Shatranj

Post by enhorning »

Fatal error: Variant Shatranj not supported by ChessV_Winboard

... that's pretty much what I got back when I tried it for some other variant with WB 4.6.2 as well.
User avatar
hgm
Posts: 28454
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

OK, this is a Shatranj-specific bug of ChessV. It does not announce shatranj amongest the list of variants it supports in the variants feature. Nevertheless, this can be worked around by installing it as a WB v1 engine. Then WinBoard does not ask for features with the protover command, and it will assume the engine plays the variant WinBoard is set for at the time of engine loading.

As ChessV has no other essential features, we can get away with this. The loss of 'ping' could be an inconvenience; perhaps this can be worked around by adding -firstFeatures "ping=1" to its install line. I will test that.

I could already play it against Fairy-Max without that, but it freezes when Fairy-Max promotes. Probably it does not use Q for Ferz. There also are work-arounds for that, however: ChessV allows you to define your own sub-variants of the variants it supports, in an SGF file (by starting it with the name of the SGF file as argument, rather than the name of the variant), and one of the things you can do in an SGF file is redefine the naming of pieces. I had to do this, f.e., when letting it play Bird's Chess using its opening book for it, where the native implementation uses M(arshall) for Chancellor.

I will get back to you about this.
enhorning
Posts: 342
Joined: Wed Jan 05, 2011 10:05 pm

Re: Chess variant tournament: Shatranj

Post by enhorning »

I ran another blitz test, and Sjaak seemed to work fine with promotions now. Pulsar is doing an unfortunate amount of illegal move (ignoring that it's in check, same as we previously saw in Crazyhouse).

Also, a few programs seem to be unaware that bare king and stalemate are losses - so they're not putting up as good resistance as they should have.

Still, for the most part, everything seems to work, even if the level of play sometimes suffer from unawareness of bare king losing. HaChu seemed at blitz times weaker than ShaMax, but still stronger than Pulsar and Dabbaba.
User avatar
hgm
Posts: 28454
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

OK, I managed to make it play. To circumvent the piece-naming problem, you have to make a shatranj.sgf file in the ChessV folder, containing the lines:

Code: Select all

ICS Shatranj:shatranj
$array="rnbkqbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBKQBNR"
change-piece-name("Ferz", "Queen", "Q")
change-piece-name("Elephant", "Bishop", "B")
(Not sure the last line is important, as you cannot promote to Elephant in Shatranj.)

You can then install ChessV through the Load Engine dialog with

.exe: ChessV_WinBoard.exe (point out by browsing to automatically set directory)
command-line parameters: shatranj.sgf
Special WinBoard options: -xreuse -firstFeatures "ping=1"

Tick checkboxes "WB protocol v1" and "Force current variant with this engine" (assuming you already set WinBoard for Shatranj).

That should do it, and give you the engine line in the winboard.ini file

"ChessV_WinBoard.exe shatranj.sgf" -fd "C:\Engines\ChessV" -variant shatranj -firstProtocolVersion 1 -xreuse -firstFeatures "ping=1"

This fully repairs ChessV's ping support, but suppresses the misleading info ChessV gives about the variants it supports. Not sure if the -xreuse was really needed, but better safe than sorry.
User avatar
hgm
Posts: 28454
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

enhorning wrote:HaChu seemed at blitz times weaker than ShaMax, but still stronger than Pulsar and Dabbaba.
Wow, I am really surprised at that. As I wrote, it is not much more than a skelleton engine yet, basically lacking everything. I was still at the stage of perfecting its move generator. First to make sure all move types it needs are supported by it (I still need to add area moves for Tenjiku, and hook movers for Dai Dai and up), and then to work on the incremental update of the attack map.

Its move generation is based on separate generation of captures (staged by victim value), and it uses an attack map for that, which stores (as 3-bit counts) how many times from each direction each piece is attacked or protected. Then the generator only has to scan in the corresponding directions to find the actual attacker(s). That should give efficient capture generation, and efficient QS, because you can stop generating captures as soon as you get to victims worth less than what you need to get above alpha. (Large Shogi variants have tons of pieces of insignificant value.) The current version, however, generates the attack maps from scratch in each node, by forward move generation, destroying all advantage.

On a small board with weak pieces this probably isn't too detrimental. What really hurts it is that it limits the depth of QS to 2 ply. This leads to severe horizon effect in tactically complex situations (where you can be kapt busy with recaptures upto QS). I did that because otherwise the Lions will give rise to search explosion, by engaging in plunder raids, and I wanted to be able to play test games for testing correctness of the move generator without that kind of instabilities. But in Shatranj the tactical complexity is furtunately also low.
User avatar
hgm
Posts: 28454
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant tournament: Shatranj

Post by hgm »

I just noticed a bug in ShaMax. That is, one of the fixes I made for Fairy-Max 4.8S actually backfires for ShaMax: on promotion at game level it now uses the actual value of the promotion piece to replace the default value used in the search. But I forgot that in Shatranj the default value is not that of Queen, but 8 times lower. So every promotion led to the score swinging to an immensely negative value for the promoting side. This could make it go for a rep-draw in totally won positions.

I uploaded a version that fixes this to

http://hgm.nubati.net/ShaMax.exe .