Comments/Ratings for a Single Item
I thought to make a 20x20 game with the following first-line setup: RNBRNBMCQAKQCMBNRBNR With C being Cardinal, M being Marshal and A being Amazon (that is, four of each basic pieces, two of each double compounds, and one tripple compound). I did not finish this game because knight (and pieces with knight component) required some augmentation: on such a huge board usual knight would be pawn-like. But I had no idea, what augmentation. Making three knight leaps in freely-bending directions (exactly three, to keep it colourbound) would make it overly-strong. Limiting these bendings in some way (for example, knight must keep his "long" (2 squares) direction, but may change the "short" (1 square) direction freely) would be complicated and artifical, and making him able to make one leap or three leaps in straight knightrider direction would be not enough, and artifical as well. Well, now back to the subject - my idea was that the King is able to castle with any of four rooks, or with one of two Marshals (as you see in the setup, their position are rook-like, while Queens' positions are bishop-like). Of course, with only one of them, and only once per game. Can't say for sure, but I don't think it's such a problem to uncover the path to the external rook with non-external rook: with pawn multistep augmentation, pawns can move quite far from the initial position, and a non-external rook have two sideways directions after moving forward, rather than one.
I introduced the possibility of two rook castling for Latte Chess because from playing against engines I found that the kings were getting stranded in the centre files, and it was hard to manoeuvre the pieces into a position to enable castling, without making their position worse (chess AI seems to have little problems with this - however I feel that for us humans it could be somewhat unpalatable). On the other hand I quite like the challenge of having to balance the desirability of castling with other pressing issues on the board. I came up with two ideas that seem to be feasible for Latte Chess; these being Luft Castling or Two Rooks Castling (or both together), being available in addition to normal castling. Both seem to have pros and cons. My problem with the Two Rooks Castling, in the context of Latte Chess, is that it could make castling too easy. Luft Castling (in addition to normal castling) seems more promising, as there is still some challenge in arranging castling, especially as a piece must be moved to make space for the Luft Manoeuvre. At the moment I feel that Luft Castling + normal castling seem the most promising solution, although at present I can't find a way to test it! I feel that experimenting with different kinds of castling for other variants is definitely worth trying, and should be tailored for the specific flavour and requirements of the variant. Tactical issues also need to be considered. For example Two Rooks Castling introduces the possibility of powerful double attacks on open centre (or near centre) files. Also, I have tried to find variant software to let me play against chess AI, but have been unable to find any that support this kind of feature. I would be interested if anyone knows of any easy to use software for someone with very limited programming abilities, so I can test these ideas? Thanks guys!
You can use WinBoard (on Windows) or XBoard (Linux, Mac) with Sjaak II as an engine to play Chess variants. Sjaak II is a configurable multi-variant engine, where the user can define its own variants in a text file through a rather straightforward description. (A file with instructions how to do that, with many examples, is included with Sjaak II.)
E.g. to define Judkins Shogi, the game-definition file would have to contain:
################# # Judkins Shogi # ################# Variant: Judkins Shogi (6x6) Board: 6x6 FEN: "rbnsgk/5p/6/6/P5/KGSNBR" XBoard pieces: "PNBR.S...G.++++.+Kpnbr.s...g.++++.+k" Zone: white_promotion = a5,b5,c5,d5,e5,f5,a6,b6,c6,d6,e6,f6 Zone: black_promotion = a2,b2,c2,d2,e2,f2,a1,b1,c1,d1,e1,f1 # Define the pieces Piece: Knight Move: aleap (1,2)|(-1,2) Symbol: "N", "N,n" Promotion: white_promotion, black_promotion, "+" Value: 250 Piece: Bishop Move: slide (D,A) Symbol: "B", "B,b" Promotion: white_promotion, black_promotion, "+" Value: 575 Piece: Silver general Move: aleap (0,1)|(1,1)|(1,-1)|(-1,-1)|(-1,1) Symbol: "S", "S,s" Promotion: white_promotion, black_promotion, "+" Value: 375 Piece: Gold general Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1) Symbol: "G", "G,g" Value: 450 Piece: Rook Move: slide (H,V) Symbol: "R", "R,r" Promotion: white_promotion, black_promotion, "+" Value: 650 Piece: Pawn Move: step N Symbol: "P", "P,p" Promotion: white_promotion, black_promotion, "+" Value: 80 Piece: Promoted Knight Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1) Symbol: "+N", "+N,+n" Value: 500 Piece: Dragon Horse Move: slide (D,A) Move: leap (1, 0) Symbol: "+B", "+B,+b" Value: 825 Piece: Promoted Silver Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1) Symbol: "+S", "+S,+s" Value: 490 Piece: Dragon King Move: slide (H,V) Move: leap (1, 1) Symbol: "+R", "+R,+r" Value: 950 Piece: Promoted Pawn Move: aleap (1,0)|(-1,0)|(0,1)|(0,-1)|(1,1)|(-1,1) Symbol: "+P", "+P,+p" Flags: drop_no_mate, drop_one_file Value: 530 Piece: King Move: leap (0,1)|(1,1) Symbol: "K", "K,k" Flags: royal Rule: keep capture, allow drops
Thank you! I have to say that Sjaak II looks like a very nice program, that I hadn't come across up until now - and so far I have found that it works beautifully with XBoard. The source code looks fairly easy to navigate too. I'm trying to pluck up the courage to start tinkering with it, so that I can implement double castling - although I fear that I may also need to start modifying XBoard, and quickly find myself way out of my depth. But out of all the open source chess engines I have looked at so far, this could just possibly be one that I could do something with. And even if it is beyond me, I'm sure I will have fun playing with it!
Well, a GUI is orders of magnitude more complex than an engine, and I guess XBoard is worse than most, as it evolved over decades, and most of the things it does now were added as an afterthought rather than as part of a coherent initial design. For double castling you would indeed need to modify XBoard. I haven't looked atthe precise details of double castling, but life would be much simpler if the Rook displacement would be (like normal castling) an implied side effect of a King move. Then you don't have to invent new notations for it, and would not have to touch the move parser and SAN generator. That would only leave the move generator (GenLegal() in move.c, where you would have to mess with the code that tests whether castling is allowed), and the routine ApplyMove() in backend.c, which modifies a position according to a move, (and detects a two-step sideway King move as a special case, moving the corner piece as a side effect). IMO it should be feasible for someone with no prior knowledge of the XBoard code to add support for double castling just by looking at what the existing code for standard castling does, and generalize that to involve the other Rook. I never looked at the source code of Sjaak II. I recommended it because of the comparatively straightforward way it can be configured, its availability for Windows as well as Linux and Mac, and the fact that it is open source. There exist other configurable multi-variant engines, but none that I know that combines all these favorable characteristics. Nebiyu could be stronger than Sjaak II, and configuring it is also not rocket science, but it is not open source and only available as Windows binary. Fairy-Max is rather awful to configure (I really should design a more user-friendly format to do that...), and in several ways quite limited to what it can handle (e.g. boards always have to be 8 ranks, no drop moves). It is open source, but the code, although quite small, is rather obfuscated and quite difficult to change. Still, it can do some things Sjaak II would not be able to do (such as bent sliders).
I've discovered that Sjaak II can be played in the terminal - which is good for testing, and means that I won't need to modify XBoard.
> I've discovered that Sjaak II can be played in the terminal - which is good for testing, and means that I won't need to modify XBoard. Ah yes, that is true. But you cannot do engine-engine games then, I think. And these could be useful for determining what is the better way of castling. (E.g. by allowing only Luft castling for white and only the King's one-time Knight move for black,and see who does better.)
Well here's an update... Sjaak II source code is NOT easy to navigate or understand - not by any stretch of the imagination (as would be expected, it is advanced chess AI after all). I don't know what possessed me to think it would be easy, I guess I just saw some methods and functions, and thought to myself "oh I know about those" :-) I have to say I feel a little bit embarrassed! Also you could be right about your 2 step king move idea. It could very possibly be more principled than my luft castling. But I only added the possibility of some kind of special castling rules in the notes, as tentative suggestions. And I'm resigned to the fact that I will probably never find out what is the best solution. I'm letting go of Latte Chess now - anyone is free to do what they want with it - for what it is worth (if anything). Thank you for your patience.
So there isn't really any need to start from a configurable multi-variant engine like Sjaak. Any normal Chess engine would do. You just hack in the Luft or double castling, modify the initial position, and you are done. You can pick an engine that is simple to understand and modify.
As it happens I was just writing such an engine. It is in my on-line source repository at http://hgm.nubati.net/cgi-bin/gitweb.cgi , the project 'simple.git'. (I intended to call it Simple, but it turns out that name was already taken.) The code for generating castlings in the move generator there is just
for(i=0; i<2; i++) { // try for i = 0 (Q-side) and 1 (K-side) static char cTab[] = { 1, 4, 0, 7, -1, 1, 0, 0, // table with flag-test bit, corner and direction (all 2x) 2, 8, 0x70, 0x77, -1, 1, 0, 0, }; // same for black if(!(cTab[stm+i] & rights)) { // the castling right exists int corner = cTab[stm+i+2], dir = cTab[stm+i+4]; // get applicable corner square and direction if(board[corner^1] || board[corner^2]) continue; // two squares next to corner not both empty if(board[king+dir]) continue; // square next to King not empty moves[lastMove++] = king+2*dir | king<<8 | king+dir+0x80<<16; // add castling, flagged by 0x80 + square skipped by King }You obviously would have to alter the the conditions there under which castling would be considered possible, in particular the tests for which squares should be empty. (Note it does not test for Rooks and virginity of pieces explicitly; these follow from the fact that the castling right still exists.)
Then you would have to alter the part that implements the castling side effect, which currently is
if(!(epSqr & 8) && from == king) { int rook; // move is castling; needs some extra effort to perform rookSqr = epSqr & ~0x88; // square skipped by King contained in move's flag field epSqr = (to > from ? from+3 : from-4); // KLUDGE: set epSqr to board corner, so Rook will be removed board[rookSqr] = rook = board[epSqr]; // grow Rook on square skipped by King hashKey ^= zob[rook][rookSqr]; // correct hash key for that pstEval += pst[rook][rookSqr] - 2*pst[rook][epSqr]; // and eval, pre-compensating for wrong sign of e.p. removal deltaPhase = -weight[rook]; counts[rook]++; // Rook will not really disappear from board }You would have to calculate where the other Rook is, and how you have to displace that. You would also have to add some code to UnMake to move that Rook back. In Init() you would have to assign values to some other squares of the 'spoiler' board, (which indicates which castling rights are spoiled by activity on a a given square, and thus should include the extra Rooks).
I meant that chess engine programming is too hard for me in general. I naively thought that I could copy & paste a few lines of code and make some minor alterations. But I can't understand a single line of the code that you posted. I once created an application that played Connect 4 (in Java). But that was quite a few years ago, and even then I didn't understand it (it was a copy & paste job - even at the time I didn't understand how minimax works). So I think that is why I overestimated what I was capable of. But the truth is, this is beyond me - so I'm giving up on this project now. btw I just want to say that Fairy-Max (in XBoard) was one of the first chess programs that I played after switching from Windows XP to Linux, and I still play it occasionally (it's a good Latte Chess opponent for me too)... so thanks for that :-)
Well, there won't be any copy-paste solutions to implement an entirely new form of castling, that is for sure. You would have to be able to understand existing code in order to modify it. When 'Simple' is finished, I might extend it to do a few Chess variants. I set it up in such a way that any move can be a promotion or an e.p. capture (i.e. the internal move format specifies 3 squares, the usual from- and to-square, plus an e.p. square that would also be cleaned out, but can also be used to indicate how the piece should be upgraded after the move). This makes it very well suited for 8x8 variants that would involve pieces that can do double captures, such as Mighty Lion Chess and Werewolf Chess. I might put in double castling then as well.
13 comments displayed
Permalink to the exact comments currently displayed.