How Can I Create a Variant?

Sort:
EGleb
EGleb wrote:

When dealing with multiple royals, I originally calculated king safety for both and used some sort of weighted sum (you can make some argument for any particular weight). This is in the context of Spartan Chess, where it turned out that the best option was to not bother with king safety as long as both Spartan kings are on the board. I can bring back the old code easily enough (or write something better) if needed. The question is if it is.

For Spartan Chess, the piece value of the extra royal is probably all the king safety you need. The extra king is roughly worth sacrificing a rook to capture it, which is roughly what completely wrecking king safety is worth too. So maybe it's worth something to do king safety for both kings if the value of the king is decreased for Spartan Chess.

By the way, is there a way to turn off the WYSIWYG editor on this site? In my case it often ends up as "what I see is not what I want and I can't figure out how get what I do want"?

EGleb
HGMuller wrote:

I still don't see why it would be any safer to have the King stroll around against 2 Rooks and 2 Knights in Makruk than it would be in Chess. It might be less important to do it in Makruk, because there is less to be gained by pushing your Pawns to promotion. But the logical way to treat that is to scale the King PST based on the value of Pawn promotion.

It's not, and in fact it would be scored as less safe because RRNN represent a larger fraction of the initial material. The problem occurs on the other end of the spectrum though: king safety in Makruk came out as more important than expected if simply scaled from normal chess.

Anyway, you are quite right that evaluation of identical material configurations should be invariant under changing of the initial array, so I have some rethinking to do. Not for the next release though, but perhaps for the one after that.

EGleb

Here is a Windows build of the current development snapshot: SjaakII-573.zip.

The variant description I used is this (sorry if copy&paste doesn't work correctly, I can't figure out how to not have the editor here insert paragraph breaks between lines when pasting text):

Variant: royalty

Board: 8x8

FEN: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -"

XBoard pieces: "PNBRQKpnbrqk"

Zone: rank8 = a8,b8,c8,d8,e8,f8,g8,h8

Zone: rank7 = a7,b7,c7,d7,e7,f7,g7,h7

Zone: rank2 = a2,b2,c2,d2,e2,f2,g2,h2

Zone: rank1 = a1,b1,c1,d1,e1,f1,g1,h1

 

Piece: Knight

Move: leap (2,1)

Symbol: "N", "N,n"

Allowed victims: "K,Q"

Value: 320

 

Piece: Bishop

Move: slide (D,A)

Symbol: "B", "B,b"

Allowed victims: "K,Q"

Value: 325

 

Piece: Rook

Move: slide (H,V)

Symbol: "R", "R,r"

Allowed victims: "K,Q"

Value: 500

 

Piece: Queen

Move: slide (D,A,H,V)

Symbol: "Q", "Q,q"

Flags: royal

Value: 950

 

Piece: King

Move: leap (0,1)|(1,1)

Symbol: "K", "K,k"

Flags: royal

Castle: white e1-g1 with h1

Castle: white e1-c1 with a1

Castle: black e8-g8 with h8

Castle: black e8-c8 with a8

 

Piece: Pawn

Move: step N

Capture: step NE,NW

Initial: step 2N

Symbol: " ", "P,p"

Flags: set_ep,take_ep

Promotion: rank8, rank1, "RBN"

Value: 100

Allowed victims: "K,Q"

 

Rule: checkmate = win

Rule: stalemate = draw

Rule: repeat3 = draw

Rule: check any king

 
Bozocow

I guess I'll just disclose the rules, it's caused too much confusion.  I was worried somebody might jack it, but I suppose I have this page as proof anyway.

 

The setup you just posted is basically the game, the only difference is that there are no pawns, and the Queen moves like it's a King (there might as well be two kings, if that makes more sense).  Oh, and I don't allow castling either, since 1. Rh7 Ra2 is almost always played in the beginning, so castling would give the side who did it first an unfair tempo, whilst activating their rook.

 

(And I would have to add castling for the queen, which just feels... wrong...)

 

I also just realized that you're the guy who made Sjaak... so good on you!

EGleb
Bozocow wrote:

I guess I'll just disclose the rules, it's caused too much confusion.  I was worried somebody might jack it, but I suppose I have this page as proof anyway.

 

The setup you just posted is basically the game, the only difference is that there are no pawns, and the Queen moves like it's a King (there might as well be two kings, if that makes more sense).  Oh, and I don't allow castling either, since 1. Rh7 Ra2 is almost always played in the beginning, so castling would give the side who did it first an unfair tempo, whilst activating their rook.

Ok, well, for that you only really have to change the starting position to "rnbkkbnr/8/8/8/8/8/8/RNBKKBNR w - -" above. Legality testing has to be switched off in XBoard though, because it will get confused about the presence of the two kings (and it will indicate spurious captures for all pieces). It does make quite a considerable difference to the game; I suspect that the first move advantage is considerable but I can't test it very easily because there is a large number of repeated games.

In general you needn't worry about someone nicking your idea for a chess variant. There's no money to be made from it anyway, and it helps to mention the rules to people trying to help you out.

Bozocow

That all seems to make sense, the only question I have is how to turn off legality checking in Winboard.  Other than that, I've never really managed to compile Sjaak II on my own, I needed HGMuller to help me by sending me that download link.

 

As for the first-move advantage, it's not as useful as you might think.  It's easy to pin knights that are advancing (they are the most valuable piece) using your bishops (they are the least valuable piece), and so in a way advancing a knight early can be to your detriment.  It's a fun variant, you should try it out sometime.  (I still need a name for it, I honestly can't think of a good one other than my last name, which feels kind of cliche and pretentious.)

HGMuller

In the General Options menu dialog there is a checkbox 'Test Legality'.

As all non-royals in your variant are 'iron', you could call it 'Armored Chess'.

EGleb
Bozocow wrote:

That all seems to make sense, the only question I have is how to turn off legality checking in Winboard.  Other than that, I've never really managed to compile Sjaak II on my own, I needed HGMuller to help me by sending me that download link.

You don't have to - there's a download link to the development version in my previous message.

Bozocow

What I mean is that I'm having lots of troubling compiling Sjaak II (I'm running it on Windows).  It's probably because I don't quite understand the process, so I wasn't able to get it running on Winboard until HGMuller sent me his pre-compiled package.

 

And I actually did have legality testing turned off, as it happens.  Strangely the engines will still freeze when trying to castle despite this.

EGleb
Bozocow wrote:

What I mean is that I'm having lots of troubling compiling Sjaak II (I'm running it on Windows).  It's probably because I don't quite understand the process, so I wasn't able to get it running on Winboard until HGMuller sent me his pre-compiled package.

 

And I actually did have legality testing turned off, as it happens.  Strangely the engines will still freeze when trying to castle despite this.

You don't have to compile it, the package I linked to above is already compiled (for Windows). Just load up the engine in WinBoard and you're good.

If you start from the position I gave earlier ("rnbkkbnr/8/8/8/8/8/8/RNBKKBNR w - -") the engine should never try to castle (since csatle rights have been cleared).

Bozocow

Oh, well there you go!  Thanks for that EGleb, and you're program is awesome!

Bozocow

It works!  I'm so excited, it's super cool to see Sjaak II's method to playing my game.  It isn't what I had expected at all, the opener is completely different!  Very cool stuff.

 

I don't mean to burden you, but I was wondering if Sjaak II can use an opening book.  If you tell the program to play my variant against itself, white always wins, despite the fact that if you force it to respond to white's move (which is always 1. Rh7) using 1 ... Bg7 it will at least draw, and sometimes win.  (Play continues with 2. Bg5+ Ne7 when the engines play each other.)

EGleb
Bozocow wrote:

I don't mean to burden you, but I was wondering if Sjaak II can use an opening book.  If you tell the program to play my variant against itself, white always wins, despite the fact that if you force it to respond to white's move (which is always 1. Rh7) using 1 ... Bg7 it will at least draw, and sometimes win.  (Play continues with 2. Bg5+ Ne7 when the engines play each other.)

Opening book support is on my list of things I want to include, but it's not entirely trivial to add, so it's going to be a while yet.

As a work-around, you should be able to enter a few moves (or even just a position) by hand (or from a file if you have one) and continue play from there.

HGMuller

Note that WinBoard can handle an opening book on behalf of the engine(s). It has an Edit Book menu item that you can use to add / delete / tune moves to an existing book, and a Save Games to Book function for converting a PGN file with multiple games in it to a book.

If Sjaak has an option to randomize its play, WinBoard can even use it to create a book automatically, by starting it with the option -mcBookMode, and let Sjaak play a huge number of games against itself in Match Mode. This would create the PGN file that you could convert to an opening book later.

EGleb
HGMuller wrote:

If Sjaak has an option to randomize its play, WinBoard can even use it to create a book automatically, by starting it with the option -mcBookMode, and let Sjaak play a huge number of games against itself in Match Mode. This would create the PGN file that you could convert to an opening book later.

It does, but it seems to be insufficient for this particular variant. The way I do this is a bit unconventional: I randomise the ordering of quiet moves, rather than adding a random number to the evaluation. The idea was that it would still pick a "best move" if there is one, but not prefer whatever move is generated first if there isn't. Perhaps this is not good enough; it worked fine when I added it, but the evaluation has become more complicated since then so it's entirely possible that there are fewer equal moves to choose from (in which case tweaking the ordering will only change the time-to-depth).

I would also not be entirely surprised if this variant turns out to get you into a zugzwang position quickly, and so the number of move options is actually limited, but I'd have to analyse it in more detail to know for sure.

HGMuller

Well, some more forceful randomization (perhaps with a magnitude adjustable through an option) is a useful feature in variant engines, where books are usually non-existent. At least for the opening phase.

MrNossovitch

by varying

EGleb
HGMuller wrote:

Well, some more forceful randomization (perhaps with a magnitude adjustable through an option) is a useful feature in variant engines, where books are usually non-existent. At least for the opening phase.

Indeed. I'm considering adding a "random amplitude A" for the evaluation and a "randomise N moves", and then interpolate the amplitude between A and 0 over the first N root moves.

EGleb

I have a new release of SjaakII, 1.3.0, that should offer more varied opening play. It's available here: http://www.eglebbk.dds.nl/program/chess-download.html

Bozocow

The new engine is a lot more fun to play, it doesn't just use the Scandinavian every time.

 

In the variants.txt file it's possible to change fundamental rules, e.g. repeatN = illegal instead of repeatN = draw, but when I change these rules the computer seems to ignore it, and it will draw the match anyway.  Do you know a way around this?  Also, is there a way to change the 50-move rule?  Ideally I would change its rules (50 moves without check is a draw), but removing entirely would work for me as well.