[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]
Comments by rescharn
//======================================== // Valid CRC / Chess960 Position generator //======================================== // Reference Implementation, (C) 2005 by // Reinhard Scharnagl, Munich, Germany //---------------------------------------- // Correction 2005-Feb-28 (GC-Nearness) //======================================== #include < string.h> #include < stdio.h> #define TXT_LIM 160 static char FenZone[TXT_LIM]; // insert a symbol into FEN-String // ------------------------------- // color could be: // col < 0 => not specified // col == 0 => bright square // col == 1 => dark square void PlaceIntoFEN (int cntFree, char symbol, int fieldColor) { for (int pos = 0, free = 0; ; ++pos) { if (fieldColor < 0 || ((fieldColor ^ pos) & 1)) { if (!FenZone[pos] && cntFree == free++) { FenZone[pos] = symbol; break; } } } } // generating of FEN strings // ------------------------- // nr could be // nr >= 0 creating Chess960 position (1 ... 960) // nr < 0 creating CRC position (1 ... 48000) const char *GetFen(int nr) { // knight distributions over 5 free squares static const int knight_pos[10] = { 3, // xx--- (binary encoded) 5, // x-x-- 9, // x--x- 17, // x---x 6, // -xx-- 10, // -x-x- 18, // -x--x 12, // --xx- 20, // --x-x 24 // ---xx }; // clear the working area int bit, pos = TXT_LIM; while (--pos >= 0) { FenZone[pos] = '\0'; } // test whether CRC is requested bool isCRC = (nr <= 0); if (isCRC) { nr = -nr; bool q_first = ((nr % 2) != 0); nr /= 2; PlaceIntoFEN(nr % 5, q_first ? 'q' : 'a', 0); nr /= 5; PlaceIntoFEN(nr % 5, q_first ? 'a' : 'q', 1); nr /= 5; } PlaceIntoFEN(nr % 4, 'b', 0); nr /= 4; PlaceIntoFEN(nr % 4, 'b', 1); nr /= 4; PlaceIntoFEN(nr % 6, isCRC ? 'c' : 'q', -1); nr /= 6; pos = knight_pos[nr % 10]; for (bit = 5; --bit >= 0; ) { if ((pos & (1 << bit)) != 0) PlaceIntoFEN(bit, 'n', -1); } PlaceIntoFEN(2, 'r', -1); PlaceIntoFEN(1, 'k', -1); PlaceIntoFEN(0, 'r', -1); int width = isCRC ? 10 : 8; char *pC = &FenZone[width]; *pC++ = '/'; for (pos = width; --pos >= 0; ) { *pC++ = 'p'; } for (pos = 4; --pos >= 0; ) { *pC++ = '/'; if (width >= 10) { *pC++ = '1'; } *pC++ = (char)('0' + width % 10); } *pC++ = '/'; for (pos = width; --pos >= 0; ) { *pC++ = 'P'; } *pC++ = '/'; for (pos = 0; pos < width; ++pos) { *pC++ = FenZone[pos] ^ ('a'^'A'); } strcpy(pC, ' w KQkq - 0 1'); return FenZone; } // check if FEN is valid for CRC // ----------------------------- bool IsValidCRC(const char *pFen) { // to be avoided GC position static const char *gcArray = 'rnbqckabnr'; // pawn covering pieces (like a rook) static const char *covNear = 'rcqk'; // pawn covering pieces (like a bishop) static const char *covDiag = 'baqk'; // pawn covering pieces (like a knight) static const char *covDist = 'nac'; int size = (int)(strchr(pFen, '/') - pFen); int diff = 0; for (int n = size; --n >= 0; ) { // different to GC? if (pFen[n] != gcArray[n]) { ++diff; } // unprotected pawns? if (strchr(covNear, pFen[n])) continue; if ((n+1) < size && strchr(covDiag, pFen[n+1])) continue; if ((n-1) >= 0 && strchr(covDiag, pFen[n-1])) continue; if ((n+2) < size && strchr(covDist, pFen[n+2])) continue; if ((n-2) >= 0 && strchr(covDist, pFen[n-2])) continue; return false; } // GC-near position? if (diff < 3 && size == (int)strlen(gcArray)) { return false; } return true; } // test output // ----------- int main(void) { puts('\nfirst Chess960 positions'); for (int nrFRC = 0; ++nrFRC <= 10; ) { printf('(%03d) %s\n', nrFRC, GetFen(nrFRC)); } puts('\nfirst CRC positions'); int cntValid = 0; for (int nrCRC = 0; ++nrCRC <= 48000; ) { const char *pFEN = GetFen(-nrCRC); bool valid = IsValidCRC(pFEN); if (nrCRC <= 32) { printf('(%05d %s) %s\n', nrCRC, valid ? 'ok' : '--', pFEN); } if (valid) { ++cntValid; } } printf('\n%d valid CRC arrays\n', cntValid); return 0; }
<pcode>
Results of the CRC reference code:<br>
<br>
first Chess960 positions<br>
(001) bqnbnrkr/pppppppp/8/8/8/8/PPPPPPPP/BQNBNRKR w KQkq - 0 1<br>
(002) bqnnrbkr/pppppppp/8/8/8/8/PPPPPPPP/BQNNRBKR w KQkq - 0 1<br>
(003) bqnnrkrb/pppppppp/8/8/8/8/PPPPPPPP/BQNNRKRB w KQkq - 0 1<br>
(004) qbbnnrkr/pppppppp/8/8/8/8/PPPPPPPP/QBBNNRKR w KQkq - 0 1<br>
(005) qnbbnrkr/pppppppp/8/8/8/8/PPPPPPPP/QNBBNRKR w KQkq - 0 1<br>
(006) qnbnrbkr/pppppppp/8/8/8/8/PPPPPPPP/QNBNRBKR w KQkq - 0 1<br>
(007) qnbnrkrb/pppppppp/8/8/8/8/PPPPPPPP/QNBNRKRB w KQkq - 0 1<br>
(008) qbnnbrkr/pppppppp/8/8/8/8/PPPPPPPP/QBNNBRKR w KQkq - 0 1<br>
(009) qnnbbrkr/pppppppp/8/8/8/8/PPPPPPPP/QNNBBRKR w KQkq - 0 1<br>
(010) qnnrbbkr/pppppppp/8/8/8/8/PPPPPPPP/QNNRBBKR w KQkq - 0 1<br>
<br>
first CRC positions<br>
(00001 --) aqbbcnnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/AQBBCNNRKR w KQkq - 0 1<br>
(00002 ok) qbbacnnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/QBBACNNRKR w KQkq - 0 1<br>
(00003 --) abbqcnnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/ABBQCNNRKR w KQkq - 0 1<br>
(00004 ok) qbbcnanrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/QBBCNANRKR w KQkq - 0 1<br>
(00005 ok) abbcnqnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/ABBCNQNRKR w KQkq - 0 1<br>
(00006 --) qbbcnnrakr/pppppppppp/10/10/10/10/PPPPPPPPPP/QBBCNNRAKR w KQkq - 0 1<br>
(00007 --) abbcnnrqkr/pppppppppp/10/10/10/10/PPPPPPPPPP/ABBCNNRQKR w KQkq - 0 1<br>
(00008 --) qbbcnnrkra/pppppppppp/10/10/10/10/PPPPPPPPPP/QBBCNNRKRA w KQkq - 0 1<br>
(00009 --) abbcnnrkrq/pppppppppp/10/10/10/10/PPPPPPPPPP/ABBCNNRKRQ w KQkq - 0 1<br>
(00010 --) baqbcnnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BAQBCNNRKR w KQkq - 0 1<br>
(00011 --) bqabcnnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BQABCNNRKR w KQkq - 0 1<br>
(00012 ok) bbqacnnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBQACNNRKR w KQkq - 0 1<br>
(00013 --) bbaqcnnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBAQCNNRKR w KQkq - 0 1<br>
(00014 ok) bbqcnanrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBQCNANRKR w KQkq - 0 1<br>
(00015 ok) bbacnqnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBACNQNRKR w KQkq - 0 1<br>
(00016 --) bbqcnnrakr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBQCNNRAKR w KQkq - 0 1<br>
(00017 ok) bbacnnrqkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBACNNRQKR w KQkq - 0 1<br>
(00018 --) bbqcnnrkra/pppppppppp/10/10/10/10/PPPPPPPPPP/BBQCNNRKRA w KQkq - 0 1<br>
(00019 ok) bbacnnrkrq/pppppppppp/10/10/10/10/PPPPPPPPPP/BBACNNRKRQ w KQkq - 0 1<br>
(00020 --) bacbqnnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BACBQNNRKR w KQkq - 0 1<br>
(00021 ok) bqcbannrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BQCBANNRKR w KQkq - 0 1<br>
(00022 --) bbcaqnnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBCAQNNRKR w KQkq - 0 1<br>
(00023 ok) bbcqannrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBCQANNRKR w KQkq - 0 1<br>
(00024 ok) bbcnqanrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBCNQANRKR w KQkq - 0 1<br>
(00025 ok) bbcnaqnrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBCNAQNRKR w KQkq - 0 1<br>
(00026 ok) bbcnqnrakr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBCNQNRAKR w KQkq - 0 1<br>
(00027 ok) bbcnanrqkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBCNANRQKR w KQkq - 0 1<br>
(00028 --) bbcnqnrkra/pppppppppp/10/10/10/10/PPPPPPPPPP/BBCNQNRKRA w KQkq - 0 1<br>
(00029 ok) bbcnanrkrq/pppppppppp/10/10/10/10/PPPPPPPPPP/BBCNANRKRQ w KQkq - 0 1<br>
(00030 ok) bacbnnqrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BACBNNQRKR w KQkq - 0 1<br>
(00031 ok) bqcbnnarkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BQCBNNARKR w KQkq - 0 1<br>
(00032 ok) bbcannqrkr/pppppppppp/10/10/10/10/PPPPPPPPPP/BBCANNQRKR w KQkq - 0 1<br>
<br>
21821 valid CRC arrays<br>
</pcode>
To Fergus Duniho: you are obviously unsure on the grade of distinctness between valid CRC arrays and the GC starting position. So let us do a historic approach and try to calculate the distance between GC and historic 10x8 starting arrays as from Carrera, Bird or Capablanca. I think that there are more than three reported arrays from those people. When it has been possible to patent GC being only slightly different to those positions, it should be sufficient to demand only the smallest there occurring distance. Comparing the GC array 'RNBQCKABNR' to one reported as from Bird 'RNBCQKABNR' there is a Hamming distance of only two. But I am not sure, if this Bird's array has been specified that way - I am missing still the original source. If the smallest distance indeed should be greater than three, the code I have supplied has to be changed appropriately. May be variant experts could help to solve that question doubtlessly.
To Fergus Duniho: Well, if that is indeed the historic array of Bird, then a Hamming distance of at least three (as I have specified) would be more than sufficient. So I would not change that demanded difference of three. I would like to keep the Hamming distance, because shifting a group of pieces has an immense effect on the properties of a starting array. And I think that the so created valid CRC arrays obviously are distinct from GC.
To Larry L. Smith: It seems you are targeting, that CRC should not care at all on Gothic Chess. May be you could be right. But I do not intend to have any unnecessary quarrel about that theme, so I prefer to exclude some few (15 arrays) positions. I think the remaining 21821 starting arrays nevertheless should be sufficient for CRC.
Today I have sent in an updated version of the CRC proposal. I hope that it could replace the old initial version soon and that it then would be much better to read. I want to thank here Mr. Bodlaender and all others, who help together to publish those new proposals within this 10-chess contest and for the big efforts they are putting into this huge chessvariants project! P.S.: Are there any ideas how to accomplish changed contents to become exchanged here on this site?
To Fergus Duniho: No, the rules still are the same, the overall layout should have been improved. According to your CRC Game Courier Preset I am still not familiar how to randomize or to preset a special position number. It seems to always create the same array.
Are there any ideas how to accomplish changed contents to become exchanged here on this site?
A) Sorry for not having accomplished to update the CRC content here. B) There is a first public beta of Smirf (about 1.3 MB), unrestricted until 2005/06/30. Of course this chess program is subject to further improvements: http://de.geocities.com/rsmuenchen/ The program should be handled intuitively. But also notice: a) the board could be turned by clicking on a corner of the board, b) in edit mode castling rights easyly could be switched by clicking the file letters near the involved rooks. This simplifies a consistent management of castling rights especially with Chess960 positions (maybe an idea for Arena), c) you will find possibilities to select how move possibilities should be shown or not in the help menu, d) double clicking on a move of the list of possible moves will show that move and preselect it, e) double clicking on a move of the game list will reposition the game to the related situation.
Well, I am still no fan of Open Source here. Nevertheless I have published the details of the new TMCI protocol, thus making it freely usable. That is, because I am arguing for open standards and interface descriptions.
a) CRC (Capablanca Random Chess) will be supported soon by http://www.brainking.com . b) There is a time limited Beta of SMIRF FullChess program (full functional) playing a lot of variants including CRC, for download see http://www.chessbox.de/Compu/schachsmirf_e.html . Regards, Reinhard Scharnagl.
a) CRC (Capablanca Random Chess) will be supported soon by http://www.brainking.com . b) There is a time limited Beta of SMIRF FullChess program (full functional) playing a lot of variants including CRC, for download see http://www.chessbox.de/Compu/schachsmirf_e.html . Regards, Reinhard Scharnagl.
Hi Greg, > I have been trying this version, but have some difficulties... > I have been using Janus Chess for testing. yes, from time to time there is a fully testable Smirf version, which is only time limited by an attached testing key. > First, no matter which timing mode I use, the program always seems > to make its move in less than a second. That is Smirf's behaviour when the testing key is wrong or timed out. The current beta package has a working key valid until end of September. So I prosume you are not testing the current package or have it repeatedly installed into an already existing Smirf folder where an outtimed key has been stored in its ini file (and would not be replaced). Thus repeat the installing procedure but delete any existing Smirf INI file before. In the reduced mode you are describing, Smirf abilities still could be inspected, but thinking time and some abilities are reduced. This is because Smirf is intended to become Shareware later. > Second problem is that I do not see where you decide which side(s) > are computer controlled. After a manual move is entered, it starts > thinking, but I see no way to make the computer play itself... Well, Smirf does not play against itself. It is planned to install a special form of remote playing ability to enable playing with other 10x8 chess programs. That would help to also test different engine versions to hopefully detect progresses. There is a check box 'automatic'. Switch it off, and you could enter as much moves as you like without Smirf's answering. You also could switch into the edit mode and e.g. switch the active color. > Otherwise, the program looks nice. Keep up the good work! Same for your ChessV! I hope for this there would be a remote protocol installed, too (and a beep). Ed Trice has proposed one, but it seems not to be sufficiently flexible to also support other 10x8 Chess variants. Thus I try to implement a compatible protocol superset. Do you have matching ideas? Regards, Reinhard.
There is of course a numbering scheme for Chess960 (Fischer Random Chess). I invented it some years ago, and it is widely accepted. For details see e.g. in my (German) book on Chess960 http://www.chessbox.de/Compu/fullchess1_e.html or see at the two page document I gave (first page with table) to the Chess Tigers http://www.chesstigers.de/download/chess960_regeln.pdf . With best regards, Reinhard Scharnagl.
There is of course a numbering scheme for Chess960 (Fischer Random Chess). I invented it some years ago, and it is widely accepted. For details see e.g. in my (German) book on Chess960 http://www.chessbox.de/Compu/fullchess1_e.html or see at the two page document I gave (first page with table) to the Chess Tigers http://www.chesstigers.de/download/chess960_regeln.pdf . With best regards, Reinhard Scharnagl.
Hello Greg Strong! I see, that you have tried to test out a more recent SMIRF version. First download the actual beta 1.26 from http://www.chessbox.de/Compu/schachsmirf_e.html . If you want to install it into an existing directory, make sure, that this would be empty (no INI file might exist there). The current beta has a free testing key including October. To start a game with white, simply enter a move. To make Smirf use the white pieces, simply press the right button (with the flash symbol). I just have played some Janus Chess games with it and ChessV, SMIRF has become really strong. ;-) Reinhard.
Hi Greg, the only chess program I have inspected ever has been an early version of GNU. I then immediately decided not to use anything from it. So SMIRF is completely self developed. But some strategies as known and documented in literature have influenced me. Actual today is SMIRF 1.28. As far as I can see SMIRF has a very different data structure. It is a flat interpreted 15x12 array. The pieces consist of bit encoded properties and are members of two double linked always sorted lists. There are two concurring pruning strategies: intelligence feed back (self invented) and controlled single nullmove (less important). There is only ONE engine playing a lot of 8x8 and 10x8 chess variants compatibly including traditional chess rules, Fischer castlings and the extended Capablanca piece set. One exceptional extension is Janus Chess with its symmetric castling. The evaluation (still very weak) is not done at quiet nodes but at deescalated nodes, which means, that also positional combinations are terminated instead of only piece exchanges.
To Greg Strong: You already have announced a new version of ChessV. Is there any time frame
for this? My SMIRF needs strong opponents to verify its ideas.
Best regards, Reinhard.
I would like to provide a new variant 'Taboo Chess' (if that name is not already used), which is (hardly to believe) as well a 10x8 and also a 64 squares chess variant. But I am still searching for a matching and still running contest, where it could be entered. Regards, Reinhard.
There now a german language description is available at wikipedia: http://de.wikipedia.org/wiki/Capablanca-Random-Chess
I am just about to implement Chess480 in my SMIRF program. SMIRF will then randomly select positions from Chess960, but only those, where the white king is right sided to the queen. Thus the redundant half of mirrored starting arrays is filtered out. To distinguish its FEN, a preceding 'm' is placed immediately before the castling tags block, as specified in current X-FEN.
There have been some quarrels on what currently is named Chess480 and had first been intended to propose a modification to Chess960. I welcome, that now it has lead to an own, different variant proposal. Chess480 also has been implemented e.g. in the multivariant GUI + engine SMIRF. Nevertheless I personally prefer Chess960 because of following reasons: a) The Chess960 castling rule is consistent, in Chess480 there are small variations, when the king is near to the borders: then he will move castling one step 'shorter'. b) As reflected in the name, Chess960 preserves the natural asymmetry of the chess game supporting 960 different starting arrays. In Chess480 mirrored positions lead to equivalent situations (thus SMIRF proposes only such randomized positions for Chess480, where the white Kings is on white Queen's right side). c) After castling Chess960 positions are looking more similar to traditional chess games after the opening stage. Maybe that is the reason, why the masters will stay with Chess960. Best regards, Reinhard.
Hi Gene, I mentioned your book near to mine at my SMIRF / ChessBox pages: http://www.chessbox.de/Compu/schachbuch.html . Unfortunately my German language book on Chess960 is sold only rarely about 10 pieces per quarter. So I hope for you to have better success with yours ... ;-) Your book is enlighting a lot of details also on 'fights' about right or wrong extended FEN and move representation for engines playing Chess960. Meanwhile the unnecessarily invented Fritz numbering scheme for Fischer Random Chess luckily has been withdrawn by an update of that program. Regards, Reinhard.
Hi Matthew, Chess960 preserves the genuine asymmetrie of Chess, thus its castling rules make sense, overmore thus becoming also a superset to traditional chess. But there is Chess480 with 'modern' castling (King makes two steps if possible). But Chess480 with 'symmetric' castling, as you proposed, is not yet a common variant. Nevertheless you could play all those three variants at the SMIRF chess engine and GUI. This is also true for the 10x8 board geometry. http://www.chessbox.de/Compu/schachsmirf_e.html
25 comments displayed
Permalink to the exact comments currently displayed.