Bored with orthodox Chess?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Bored with orthodox Chess?

Post by hgm »

For those who like to try something else for a change: why not make your engine play Spartan Chess? As this is a completely new Chess variant, you won't have a 30-year and 3000 Elo disadvantage compared to existing engines, and thus a much more level playing field. Spartan Chess is played on a normal 8x8 board, and is of similar complexity as orthodox Chess (and thus also quite playable for Humans). And it seems to have a much lower draw rate than the latter.

If there is enough interest, we can organize a tournament.

Image

What makes Spartan Chess so interesting, is that white and black play with different pieces; the only pieces they have in common are the Kings. So you can never get in an end-game with equal material! This means it is very hard to have a dead draw; end-games are always very interesting and dynamic. What makes it similar to Chess is that white ('the Persians') play with orthodoox FIDE pieces. But the black has a completely different opening setup, with pieces that move in other ways. And a nice twist is that black starts with two Kings!

Because the board is 8x8 and each side has 6 piece types, it might not be difficult to convert your normal Chess engine to a Spartan Chess engine.

http://www.spartanchessonline.com
FlavusSnow
Posts: 89
Joined: Thu Apr 01, 2010 5:28 am
Location: Omaha, NE

Re: Bored with orthodox Chess?

Post by FlavusSnow »

I think I'd rather do crazyhouse. Crazyhouse is just chess with the drop rule (placing a captured piece back on the board). Draws are very rare, endgames are unheard of, and branching factors are astronomical. Also there is a pretty strong following of crazyhouse on FICS... but not many engines play. There are a few old ones that do, Sjeng and Sunsetter come to mind.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Bored with orthodox Chess?

Post by hgm »

Crazyhouse is also a good variant, but it is far from trivial to convert a Chess engine to a Crazyhouse engine. Because of the drops, the high branching factor and the lack of quiet positions. Shogi (Japanese Chess) is similar.

With Spartan Chess you have none of these problems. It is just normal Chess where the pieces happen to move a little different. So most engines should be able to play it with only a minor modifications.

Furthermore, I have nothing against end-games. End-games are fun. End-games with unorthodox pieces are even more fun.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Bored with orthodox Chess?

Post by Daniel Shawul »

Ok I want to make this or another less crazy variant (two kings HG ?? :) ) one of my new year resolutions. Where can I read the rules ?
And how to test it with winboard probably against one of your engines.
merry xmas
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Bored with orthodox Chess?

Post by hgm »

That would be great! The rules are elaborately described on the website I gave the link to in the first post. In short:

Opening setup: lgkcckwl/hhhhhhhh/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1

K,Q,R,B,N,P: as in FIDE rules

W (Warlord) moves and captures as Bishop or Knight (i.e. Capablanca's Archbishop)
G (General) moves and captures as Rook or King (i.e. as the Shogi Dragon King)
C (Captain) moves and captures 1 or 2 steps orthogonally (= along Rook path), where it can jump over a piece if necessary.
L (Lieutenant) moves and captures 1 or 2 steps diagonally, where it can jump over a piece if necessary, but can also make a 1-step sideway non-capture move (to switch color).
H (Hoplite): captures 1 square straight ahead, non-captures 1 square diagonally forward. On the 7th rank it can also non-capture 2 steps diagonally, jumping over a piece if necessary. When it reaches 1st rank, it promotes to any of the Spartan pieces (so usually Warlord, as this is the strongest).

There is no en-passant capture (with the differently moving 'Pawns' e.p. capture would make little sense).

Black is considered in-check when _all_ his Kings are exposed to capture, and is checkmated when he cannot resolve this condition with his move. So it is legal for black to leave one King in check, after which it could be captured, and he has to finish the game with only one King (which is then checkmated in the normal way).

I admit that initially I also thought this two-King business was a bit weird. But after watching a large number of games, I have come to realize that this is actualy a billiant idea. For one, it cause the KKK end-game to be a win for the side with two Kings. And it looks very funny that black defends against an attack on only one of his Kings by Rook or Queen through protecting it, rather than stepping out of the check.

I implemented Spartan Chess in Fairy-Max, and the amount of code I had to add to handle the two Kings was quite limited: I had to keep a count of each piece type (which most engines do anyway for the purpose of indexing a material table). In stead of immediatey declaring an illegalmove if a King-capture is found, I first check if there is only one King; if not, I have a variable that contains the square number of an attacked King, and if it is invalid (like it was initialized) I set it to the square of the attacked King. If it is already set to a different valid value, it must mean both Kings are attacked, and the move was illegal.

Currently Spartan Chess can only be played as ariant fairy, with legality checking switched off. But if there are going to be other engines, I will make it one of the standard variants supported by WinBoard.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Bored with orthodox Chess?

Post by Daniel Shawul »

Thanks. I have given it some thought and decided to start from scratch. There is a lot of orthodox chess specific code in Scorpio which would make
things a real mess. I am gonna start coding for a general board game where you can define the rules ,i.e how the pieces move, in a templatized code. Piece lists seem natural data structure for supporting many variants but it seems the board representation should be the simplest one(not even 0x88)
,to support smaller or larger size board games or something alien like checkers ?. I need to figure out what I want and how to go about it.
Daniel
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Bored with orthodox Chess?

Post by Michael Sherwin »

Daniel Shawul wrote:Thanks. I have given it some thought and decided to start from scratch. There is a lot of orthodox chess specific code in Scorpio which would make
things a real mess. I am gonna start coding for a general board game where you can define the rules ,i.e how the pieces move, in a templatized code. Piece lists seem natural data structure for supporting many variants but it seems the board representation should be the simplest one(not even 0x88)
,to support smaller or larger size board games or something alien like checkers ?. I need to figure out what I want and how to go about it.
Daniel
A vector + magnitude approach would seem to be a good choice. Whether you use a maximum array size or get memory/pointers from the heap the vectors and the magnitudes can be used quite naturally. For a piece on a square use a u32 var to keep the bit index accessed by BSF32 for the possible directions and a magnitude for each [square][direction] so the edge of the board is not crossed. Then all that is needed to generate the pseudo legal moves is a couple of nested count down loops for each vector type.
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Bored with orthodox Chess?

Post by Daniel Shawul »

I will try to mimic current scorpio board representation i.e 14X16. So for an X by Y board that is (2X) by (Y + 6).
This should be ok to detect off the board squares without indirect addressing as in the mailbox. And also table lookups by square differences should work
but the 0x88 test can only work for multiple of 2 board sizes.
While thinking about this, I noticed people use 12X16 not 14X16, which is achieved by appending 4 files on edges of the board.


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

Re: Bored with orthodox Chess?

Post by hgm »

For orthodox Chess 2 guard rows is sufficient, to catch Knight moves. (And in Xiangqi it can also catch Cannon captures without special tests.) In fact none of the variants supported by WinBoard has pieces that can jump over 2 squares. (Such pieces are much too dangerous to give good variants.) One of the reasons I proposed Spartan Chess is that it uses a standard 8x8 board, so 0x88 and 12x16 can be used without modification. In Joker80 I use a 12x32 board, so that I can use a 0x110 trick in stead of 0x88. In my Xiangqi and Shogi engine I abandoned the power-of-two rank size, because they have more than 8 ranks of more than 8 squares, and it was most important to limit square numbers to a single byte. In the Xiangqi engine I use a 14x20 board, because when I started writing it, it was intended as a general variant-capable engine for boards upto 10x10. For Shogi I use 13x18, to get maximum packing density of PST, and allow the holdings to be addressable by square numbers < 256, so that drop moves can be performed by the same code as normal moves.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Bored with orthodox Chess?

Post by Daniel Shawul »

hgm wrote:For orthodox Chess 2 guard rows is sufficient, to catch Knight moves. (And in Xiangqi it can also catch Cannon captures without special tests.) In fact none of the variants supported by WinBoard has pieces that can jump over 2 squares. (Such pieces are much too dangerous to give good variants.) One of the reasons I proposed Spartan Chess is that it uses a standard 8x8 board, so 0x88 and 12x16 can be used without modification.
Right I could have used 2 guard rows ,instead of 3, with an offset of 2 * 16 + 4 = 32.
Somehow I thought having all off-board squares on the right half (the way 0x88 board
is usually depcited) would make a difference. Anyway I will keep it because it can support
a 3-step straight jumper.It also allows me to store mid/end game values of a 0x88 board in a compact table where pst[sq] & pst[sq + 8]
represent mid/end game values, something not possible with a 15X12 board f.i.
In Joker80 I use a 12x32 board, so that I can use a 0x110 trick in stead of 0x88. In my Xiangqi and Shogi engine I abandoned the power-of-two rank size, because they have more than 8 ranks of more than 8 squares, and it was most important to limit square numbers to a single byte. In the Xiangqi engine I use a 14x20 board, because when I started writing it, it was intended as a general variant-capable engine for boards upto 10x10. For Shogi I use 13x18, to get maximum packing density of PST, and allow the holdings to be addressable by square numbers < 256, so that drop moves can be performed by the same code as normal moves.
From your experience, it is clear different bit-trick optimizations are possible depending on the
the board size & jumpers. I will give up all of those for a flexible board size.
It will surely be not the best representation for a specific game but robusteness is a priority
for this engine I am writing. I have to change also move representation and move history stack to
allow capture of multiple pieces and "insertion type of move" as in checkers & go.
This is a bit optimistic I know, but having one code to try out different board game ideas is
convinient.