Grand Chess

Discussion of chess software programming and technical issues.

Moderator: Ras

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

Grand Chess

Post by hgm »

I am currently running a Grand Chess demo match between Spartacus and ChessV at http://80.100.28.169/gothic/grand.html . Grand Chess is a bit harder to implement than Knightmate or Spartan Chess, because of the bigger board. In addition the promotion rules are cumbersome. (Promotion zone 3 ranks deep, but promotion only to pieces you lost before.)

Nevertheless, people that want to try are welcome. Spartacus is also still under development (no correct promotion rules in its search yet), and ChessV can't use its opening book yet under WinBoard. (Of course I am hoping for Nebiyu, as I know itcan already do the board size... :wink: )
Daniel Shawul
Posts: 4186
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Grand Chess

Post by Daniel Shawul »

1 hour to implement + debug :) There are probably tons of bugs in there but
it played one game till the end. I will fix bugs this weekend. Here it is https://sites.google.com/site/dshawul/N ... ects=0&d=1

----------
* variant "grand" or "alien"

* setup (PNBRQ..AC............Kpnbrq..ac............k)
--------------------

Qn: Say a pawn is on the 9th rank , also it can capture & promote to the 10th but there is no captured piece to promote to. So what happens here. I discard the capture right ?? For the noncaps it clearly states to wait but am not sure for the caps.


Btw it still much weaker than the infamous 16_xx though. I will start decompiling that version to see what bug is making it so so strong atleast against newer versions :(
User avatar
hgm
Posts: 28502
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Grand Chess

Post by hgm »

The way I understand the rules is that captures to the last rank with no piece available are also illegal, unless you capture a King. So having a Pawn on the last rank has the same status as being in check.

I have not decided on the notation yet; A+C is good for playing on my ICS, which already spports the pieces under these names. The 'standard' notation seems to be C (Cardinal) for Archbishop, and M (Marshall) for Chancellor, though. ChessV used C+M, but the names can be redefined there.
Daniel Shawul
Posts: 4186
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Grand Chess

Post by Daniel Shawul »

It looks like it is playing ok. Is there a website with piece values ? I just added the piece values of the orthodox sets for the two fairy pieces (A & C).

Edit:

Suggestion for the website : A fast forward button to go to the current state of the board. Sometimes it could take too long when it animates each move.

4th game b/n spartacus and nebiyu is adjuncated as stalemate , why ?

I can not replay the pgn on my winboard. Is there a latest version that handles Grandchess pgns ?
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Grand Chess

Post by Evert »

I think I've worked out how to make BigSjaak out of Sjaak, shouldn't be very hard.
The question is whether I'll find the time to do it or not...
User avatar
hgm
Posts: 28502
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Grand Chess

Post by hgm »

For a mailbox engine t should be doable. The biggest problem I had in the conversion was with my move encoding. I used off-board to-squares to encode promotions/castling/e.p. moves. For promotions the rank field encoded the promotion piece, (as the promotion rank was implied by the fact that it was a promotion), and the file encoded the file (with a fixed offset to shift it off-board.)

But in Grand chess that didn't work, as there are three promotion ranks. But I could solve that by switching to a system where I encode the step vector rather than the to-square. Then I only need 3 codes per piece type.

I am still working on designing a suitable indexing scheme for the material table for the Capablanca piece set, without making the material table unacceptably large. I think I have a good system now, based on a (liearized) 7-dimensional array indexed by the number of white & black Bishops and Pawns (separately), the total number of Queens, the total number pieces (not counting the Bishops, Pawns,and Kings, so 0-14), and the material imbalance on a scale P=1, B,N=3, R=5, Q,C,A=10 (only taking the range -7 to +7 into account). That makes the table 3x3x11x11x3x15x15 = 726KB.

I did not realize this before, but this set of 7 parameters uniquely specifies the material imbalance, if the imbalance is indeed in the range -7...+7, and there are not more of any piece type as in the opening position. There are several material combinations that map to the same imbalance, like +4 = Q-MM | RR-MM | MMM-R (where M=N,B). But the Q-MM case can be distinguished from the RR-MM case by the totalnumber of pieces being odd or even. RR-MM and MMM-R have both an even total number, but are decided by the number of Bishops for each side. The side with the largest number of Bishops must have the most minors; equal number of Bishops implies RR-MM. The number of Queens is only needed to reconize Q vs C,A imbalances.

With this index I can award B-pair bonus (as nr of B of either side is explicitly known), a bonus for trading Pieces or Pawns depending on whether you are behind or leading, penalize the leading side for murky imbalances (like RP-NN or N-PPP), and uniquely recognize drawn and drawish compositions like KBK, KNNK, KBKPP, KBPKP, all through the table.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Grand Chess

Post by Evert »

hgm wrote:For a mailbox engine t should be doable.
Sjaak, of course, is a bitboard program. ;)
That's not really an obstancle though, the easiest way to make the translation is to switch from C to C++ and define bitwise operators for the bitboard class. The main issue is that size of the lookup tables increases exponentially.
It may not be the most suitable data structure for a general board size, but I view that as a challenge rather than an obstacle. :D

<quote>The biggest problem I had in the conversion was with my move encoding.</quote>
That's another issue: Sjaak uses six bits to encode a square, I'd need to bump that up to seven bits. I think I have enough empty space in the move definition to make that work though.

In terms of rules, I only need to deal with promotions being optional on the 8th and 9th ranks (does the pawn only have the right to promote when it reaches those squares? I need to check). The rule that you can only promote to a piece type that has been captured needs some consideration as well, the easiest way to do it is probably to just put a cap on the number of pieces of a particular type the player can have, which I already have for kings in Spartan chess. An alternative is to make captured pieces go into a player's holdings and select promotion pieces from there.
The value of a passed pawn should probably scale with the value of the largest available promotion piece too.

My main reservation for doing this would be that if I enable 10x10, I'd want to enable 10x12, 11x11 and 12x10 as well (not all of these will be equally interesting) and I need to think a bit on how to do that effectively.
Does XBoard handle board sizes larger than 10x10?
TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

Re: Grand Chess

Post by TonyJH »

Hi H.G.
Is there a version of Winboard that supports Grand Chess?
User avatar
hgm
Posts: 28502
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Grand Chess

Post by hgm »

I just made that, ('variant grand'), but I haven't posted it. (There are still some design issues, such as which letters to use for the pieces.) Before yesterday I was plaing Grand Chess as /variant=fairy, with /boardHeight=10 /boardWidth=10 and /testLegality=false. That only works if the engine has 10x10+0_fairy in its variants feature (which Spartacus has, and Gregory added to ChessV on my request), and understands it as Grand Chess. (ChessV ignores the variant command anyway; the variant has to be selected from the engine command line.

It seems the new WinBoard did pass its first test of Grand Chess, with the Nebiyu-Spartacus match tonight. Although this morning the window stays completely blank after resizing. But that must be a Vista problem, as yesterday it was working.
User avatar
hgm
Posts: 28502
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Grand Chess

Post by hgm »

Daniel Shawul wrote:4th game b/n spartacus and nebiyu is adjuncated as stalemate , why ?
It was Nebiyu that apparently claimed it. (Note it does not say: "XBoard adjudication: stalemate", but just "stalemate".) I did not have Verify Engine Claims on initially. (Before I was playing with legality testing off, and then none of the adjudications can work anyway.) I did switch it on afterwards, but this seems to make it worse: there are many games now where Nebiyu was forfeited for false stalemate claims. Presumably where it checkmated, and thus should have won. (But as my WinBoard screen stays all blank this morning on my Chess PC, I cannot check that.)

Checkmate detection is apparently still not working for Grand Chess in WinBoard, or it should have kicked in before adjudicating the engine claim. I guess I know why; I implemented Grand Chess with holdings (to select the promotion piece from, like variant super and variant great), and it probably think you can drop from the holdings. That means I have forgotten the corresponding if statement in the mate test.

I will post the grand-Chess version of WinBoard when I fixed that.