Check out Atomic Chess, our featured variant for November, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Comments by Reinhard Scharnagl

Earlier Reverse Order LaterLatest
[Subject Thread] [Add Response]
Reinhard Scharnagl wrote on Tue, Jun 8, 2004 10:06 PM UTC:
You now will find my 10 German/English Web pages on Fischer Random Chess at: <a href='http://homepages.compuserve.de/rescharn/Compu/fullchess1_e.html' title='The FRC Site'>The FRC Site</a>. Here you will find an overview of a new FRC book (to be published July 2004) in German language 'Fischer-Random-Schach (FRC/Chess960)' as a German language PDF document: <a href='http://homepages.compuserve.de/rescharn/Down/FRC_Materialien.pdf' title='FRC Book Overview'>FRC Book Overview</a>. The downloadable freeware FRC FullChess FEN Editor Version 1.4.0 (German/English) is described at: <a href='http://homepages.compuserve.de/rescharn/Compu/fullchess7_e.html' title='FRC FEN Editor'>FRC FEN Editor</a>.

Fischer Random Chess. Play from a random setup. (8x8, Cells: 64) (Recognized!)[All Comments] [Add Comment or Rating]
Reinhard Scharnagl wrote on Tue, Jun 8, 2004 10:09 PM UTC:
You now will find my 10 German/English Web pages on Fischer Random Chess at: <a href='http://homepages.compuserve.de/rescharn/Compu/fullchess1_e.html' title='The FRC Site'>The FRC Site</a>. Here you will find an overview of a new FRC book (to be published July 2004) in German language 'Fischer-Random-Schach (FRC/Chess960)' as a German language PDF document: <a href='http://homepages.compuserve.de/rescharn/Down/FRC_Materialien.pdf' title='FRC Book Overview'>FRC Book Overview</a>. The downloadable freeware FRC FullChess FEN Editor Version 1.4.0 (German/English) is described at: <a href='http://homepages.compuserve.de/rescharn/Compu/fullchess7_e.html' title='FRC FEN Editor'>FRC FEN Editor</a>.

Reinhard Scharnagl wrote on Sat, Jun 12, 2004 11:07 AM UTC:
My Web pages have moved to: <a href='http://www.chessbox.de/Compu/fullchess1_e.html' title='The FRC Site'>The FRC Site www.chessbox.de</a>.

Capablanca's chess. An enlarged chess variant, proposed by Capablanca. (10x8, Cells: 80) (Recognized!)[All Comments] [Add Comment or Rating]
Reinhard Scharnagl wrote on Fri, Nov 26, 2004 07:19 PM UTC:
There is a new program Smirf (still beta) playing not only 8x8 classic
chess and Fischer Random Chess but also 10x8 Chess variants based on the
Capablanca piece set. It supports also Janus chess and the Capablanca
Random Chess (or FullChess) variant proposed by myself since several
months:

CAPABLANCA RANDOM CHESS (2004-Nov-26) Proposal 

This definition of CRC should cover the following goals:

a) creating an interesting drosophila for chess programmers 
b) using Capablancas 10x8 Chess board geometry 
c) using Capablancas piece set (incl. archbishop and chancellor) 
d) applying rules aligned to Fischer Random Chess 
e) avoiding conflicts to any claimed patents 

The CRC rules are: 

a) creating a starting position (one of 48.000): 
 1) the bishops have to be placed upon different colored
  squares; same rule applies to the implicite bishop pieces:
  queen and archbishop (aligned to FRC)
 2) the king always has to be placed somewhere between the 
  rooks to enable castlings (aligned to FRC)
 3) use only such positions without unprotected pawns (Chess)

b) describing a method of generating starting positions on 
   free squares by using a dice or random number generator: 
 1) select queen or the archbishop to be placed first (2x)
 2) place the selected 1st piece upon a bright square (5x)
 3) place the selected 2nd piece upon a dark square (5x)
 4) one bishop has to be placed upon a bright square (4x) 
 5) one bishop has to be placed upon a dark square (4x) 
 6) one chancellor has to be placed upon a free square (6x) 
 7) one knight has to be placed upon a free square (5x) 
 8) one knight has to be placed upon a free square (4x)/2 
 9) set the king upon the center of three free squares left
11) set the rooks upon the both last free squares left 
12) this establishes White's first row, the Black side 
    has to be built up symmetrically to this 
13) place ten pawns similar to traditional chess in a row 
14) skip this position if it has unprotected pawns or not
    at least three positions in line 1 differently filled
    compared to Gothic Chess, this finally gives about
    21.259 distinct starting arrays.
   
c) nature of (asymmetric Fischer-) castlings:
 1) castlings are (like in traditional chess) only valid
  if neither the affected king or rook has been moved, or
  there would be a need to jump over any third piece, or
  the king would be in chess somewhere from his starting
  position to his target field (both included). Therefore
  all squares between king and its target square (included) 
  have to be free from third pieces, same applies to the
  way the rook has to go to its target square.
 2) the alpha-castling (O-O-O, White's left side):
  like in FRC the king will be placed two rows distant
  from the border (here c-file) and the rook at the next 
  inner neighboured square.
 3) the omega-castling (O-O, White's right side):
  like in FRC the king will be placed one row distant
  from the border (here i-file) and the rook at the next 
  inner neighboured square.

d) performing castlings:
 within a GUI try to move the king upon the related rook
 or at least two squares into that direction; manually:
 1) move the king outside of the board
 2) move the rook to its end position (if need to)
 3) move the king to his end position

e) extended FEN encoding:
 1) the extended FRC-FEN could be used as a base
 2) 'a'/'A' are used to identify archbishops
 3) 'c'/'C' are used to identify chancellors
 4) '9' is used to mark nine empty fields
 5) '0' is used to mark ten empty fields
 6) if a castling enabled rook is not the most outer one
  at that side, the letter of his file has to be placed
  immediately following his castling marker symbol, where
  'q'/'Q' are used for the alpha-, 'k'/'K' for omega-side.
 
f) engine notation rules for castling moves:
 According to UCI convention the castling moves should be
 written by using both coordinates (source and target field)
 of the involved king. But there are castlings, where the 
 king does only one or none simple step. In that cases the 
 castling should be distinguishable by appending a 'k', like
 already practized in promotion moves to make them unique.
 Overmore an engine should accept O-O or O-O-O (no zeroes),
 but only use them, when the GUI would demand for such a
 less precise notation.

Reinhard Scharnagl wrote on Sun, Nov 28, 2004 04:40 PM UTC:
Hi! So see me astonished, I have not thought on such a congruency. If you
would have inspected my homsite www.chessbox.de, you would have detected
that proposal much earlier. But I think, that it should be a better place
here to introduce and discuss that proposal than at a private hompage.

You try to motivate also to include Janus chess somehow within that
proposal. If you would have noticed in my current Smirf program beta,
Janus chess is included in that fine 10x8 and 8x8 aware program. But I
have to learn, that there are some incompatibilities, which force to
exclude Janus from that ramdom idea: a) the notation for castling is
reversed, b) the usage of 'J' instead of 'A' in FEN and encoded moves,
c) the need to also encode the inverted castling by preceeding the castling
block within FEN with an 's' for 'symmetric'. 

If you would spend some time in watching the Smirf program approach you
would notice such interesting things like that it supports all capablanca
based positions (and even CRC or Janus chess) and a PGN load and save of
played games.

Regards, Reinhard.

Reinhard Scharnagl wrote on Sun, Nov 28, 2004 10:02 PM UTC:

Well, I do not want to talk that much on Janus Chess here. But the difference is more subtile, e.g. the a-side castling brings the king to the b-file instead of the c-file.

When I have understood your intentions right (I am not sure) you want to know something on the filtering of those 48.000 basic positions. Well, the idea is, that having such a big bool of randomized targets, it would be a good idea to kick off all of them which could have the potential to be an argument that the CRC would produce unfair or unstable positions. So reducing to about 21.000 positions without undefended pawns will nevertheless leave back a huge number of possible starting arrays, which might be sufficient for the current century.

Reinhard.


Recognized Chess Variants. Index page listing the variants we feel are most significant. (Recognized!)[All Comments] [Add Comment or Rating]
Reinhard Scharnagl wrote on Mon, Nov 29, 2004 10:32 AM UTC:
What can I or others do to make my Capablanca Random Chess (or FullChess) proposal to become recognized someday? I have not yet fully understood that process ... So all I can do is probably wait and see ...

Reinhard Scharnagl wrote on Mon, Nov 29, 2004 08:18 PM UTC:
Greg, let me add some statements to the discussion here: it is essential,
like in FRC/Chess960, that the drawing of the to be played starting array
is done immediately before the game will begin. Thus possible weaknesses,
also because equally distributed on both sides, could not be used to
prepare a strategy based on unbalances. Avoiding uncovered pawns only will
exclude obviously weak points and have the players focus on a good
positional and creative play.

The FEN notation is subject to be improved. There seem to be some
incompatibilities using '0' for ten empty squares compared to a FFEN
approach. Thus I am thinking to not encode any empty squares finishing a
line (for 10x8 boards only). It seems as if that would cause less
problems.

There is already a homepage of CRC / FRC and more, see
http://www.chessbox.de/Compu/schachcrc_e.html and a lot pages around.

My book on Fischer Random Chess is available in German language only. And
because it is not a bestseller (9 copies have been sold in quarter 3 2004)
I doubt whether a translation into English would pay.

Reinhard Scharnagl

Reinhard Scharnagl wrote on Tue, Nov 30, 2004 09:23 AM UTC:
Sorry for having overseen that some errornously calling me 'Dr.', but there is none.

Capablanca's chess. An enlarged chess variant, proposed by Capablanca. (10x8, Cells: 80) (Recognized!)[All Comments] [Add Comment or Rating]
Reinhard Scharnagl wrote on Tue, Nov 30, 2004 02:51 PM UTC:
Question on encoding Capablanca FEN strings:

Smirf actually encodes positions like:
rnbqckabnr/pppppppppp/0/0/0/0/PPPPPPPPPP/RNBQCKABNR w KQkq - 0 1

do you think it would be better to use completed numbers like:
rnbqckabnr/pppppppppp/10/10/10/10/PPPPPPPPPP/RNBQCKABNR w KQkq - 0 1

I am not sure, what to do. So I am gathering arguments.

Reinhard.

Reinhard Scharnagl wrote on Thu, Dec 2, 2004 11:10 AM UTC:
Currently I decided to use the second form using '10' to encode ten empty squares.

Reinhard Scharnagl wrote on Thu, Dec 2, 2004 09:40 PM UTC:
There has been stated that CRC (Capablanca Random Chess / FullChess) would
not yet be playable e.g. as a Zillons emulation. But that is not quite
correct. Of course there already a beta version is existing of the soon to
be finished Smirf program. You could find it downloadable at
http://www.chessbox.de/beta.html (see Project Chronicle at 2004-Sep-29).
But it has to be remarked that this is a version finally to be released as
shareware. Thus a lot of functions are shrinked and the user sometimes will
be 'invited' to watch the licensing screen.

Fischer Random Chess. Play from a random setup. (8x8, Cells: 64) (Recognized!)[All Comments] [Add Comment or Rating]
Reinhard Scharnagl wrote on Thu, Jan 6, 2005 07:50 PM UTC:
There is aready my proposal for Capablanca Random Chess. I repeat it here:

CAPABLANCA RANDOM CHESS (2004-Nov-26) Proposal 

This definition of CRC should cover the following goals:

a) creating an interesting drosophila for chess programmers 
b) using Capablancas 10x8 Chess board geometry 
c) using Capablancas piece set (incl. archbishop and chancellor) 
d) applying rules aligned to Fischer Random Chess 
e) avoiding conflicts to any claimed patents 

The CRC rules are: 

a) creating a starting position (one of 48.000): 
 1) the bishops have to be placed upon different colored
  squares; same rule applies to the implicite bishop pieces:
  queen and archbishop (aligned to FRC)
 2) the king always has to be placed somewhere between the 
  rooks to enable castlings (aligned to FRC)
 3) use only such positions without unprotected pawns (Chess)

b) describing a method of generating starting positions on 
   free squares by using a dice or random number generator: 
 1) select queen or the archbishop to be placed first (2x)
 2) place the selected 1st piece upon a bright square (5x)
 3) place the selected 2nd piece upon a dark square (5x)
 4) one bishop has to be placed upon a bright square (4x) 
 5) one bishop has to be placed upon a dark square (4x) 
 6) one chancellor has to be placed upon a free square (6x) 
 7) one knight has to be placed upon a free square (5x) 
 8) one knight has to be placed upon a free square (4x)/2 
 9) set the king upon the center of three free squares left
11) set the rooks upon the both last free squares left 
12) this establishes White's first row, the Black side 
    has to be built up symmetrically to this 
13) place ten pawns similar to traditional chess in a row 
14) skip this position if it has unprotected pawns or not
    at least three positions in line 1 differently filled
    compared to Gothic Chess (patented), this finally gives
    about 21.259 distinct starting arrays.
   
c) nature of (asymmetric Fischer-) castlings:
 1) castlings are (like in traditional chess) only valid
  if neither the affected king or rook has been moved, or
  there would be a need to jump over any third piece, or
  the king would be in chess somewhere from his starting
  position to his target field (both included). Therefore
  all squares between king and its target square (included) 
  have to be free from third pieces, same applies to the
  way the rook has to go to its target square.
 2) the alpha-castling (O-O-O, White's left side):
  like in FRC the king will be placed two rows distant
  from the border (here c-file) and the rook at the next 
  inner neighboured square.
 3) the omega-castling (O-O, White's right side):
  like in FRC the king will be placed one row distant
  from the border (here i-file) and the rook at the next 
  inner neighboured square.

d) performing castlings:
 within a GUI try to move the king upon the related rook
 or at least two squares into that direction; manually:
 1) move the king outside of the board
 2) move the rook to its end position (if need to)
 3) move the king to his end position

e) extended FEN encoding:
 1) the extended FRC-FEN could be used as a base
 2) 'a'/'A' are used to identify archbishops
 3) 'c'/'C' are used to identify chancellors
 4) '9' is used to mark nine empty squares
 5) '10' is used to encode ten empty squares
 6) if a castling enabled rook is not the most outer one
  at that side, the letter of his file has to be placed
  immediately following his castling marker symbol, where
  'q'/'Q' are used for the alpha-, 'k'/'K' for omega-side.
 
f) engine notation rules for castling moves:
 According to UCI convention the castling moves should be
 written by using both coordinates (source and target field)
 of the involved king. But there are castlings, where the 
 king does only one or none simple step. In that cases the 
 castling should be distinguishable by appending a 'k', like
 already practized in promotion moves to make them unique.
 Overmore an engine should accept O-O or O-O-O (no zeroes),
 but only use them, when the GUI would demand for such a
 less precise notation.

Reinhard Scharnagl wrote on Sat, Jan 8, 2005 05:22 PM UTC:
I want to make clear, that I do not intent to patent the idea of CRC.
Everybody who like it, may use it freely. Nevertheless it is not public
domain concerning the idea, because I want to be asked when changes or
improvements should become necessary. In so far I claim my copyright on
that idea. 

As an example currently there is a discussion, how the new pieces should
be represented. Indeed it seems neither being simple nor to be skipped
finding appropriate icons DISTINCT to existing and RELATED to the GAITS of
the represented pieces. The solution Smirf (my program being able to play
FRC and CRC, see: [http://www.chessbox.de/_tmp/SmirfPrototyp.png]) provides
for that problem thus avoids the usage of horse heads or bishop hats. And
for newcomers additionally to those pictures it might be helpful also to
use new and better names, where some already have been introduced here: 

CROSSED SWORDS: A=ARCHANGEL (ger. E=Erzengel, protecting the paradise with
swords) instead of Archbishop or Janus 
ROOK on a HORSESHOE: C=CENTAUR (ger. Z=Zentaur, because of its double
nature, horse part below) instead of Chancellor

See for that at: [http://www.chessbox.de/Compu/schachveri1_e.html]

To Greg Strong: I still want to avoid unnecessary conflicts with Ed Trice.
Nevertheless I agree, that randomly produced starting arrays hardly could
be regarded as trial to break a patent, where chances are 1:21.000. May be
it would help to specify an ERC variant: EUROPEAN RANDOM CHESS without
that GC avoiding rule, because such patents seem not to be valid in Europe,
also reflecting the European history of that extended 10x8 variant.

Capablanca's chess. An enlarged chess variant, proposed by Capablanca. (10x8, Cells: 80) (Recognized!)[All Comments] [Add Comment or Rating]
Reinhard Scharnagl wrote on Sat, Jan 8, 2005 06:07 PM UTC:

Why filter random positions based on Capablanca' extended board?

Let's talk first on FRC (I have written a small book on that in German language). One main intention to create FRC (or Chess960) has been to make it impossible to provide a complete opening theory for each position. Thus the number of 960 distinct starting positions is helpful to reach that goal. Uncovered pawns are not that problematic because any situation will have to be set up randomly very short before a game starts.

Looking at the Shogi game there are indeed three uncovered pawns in the beginning and the game still does exist today.

Capablanca's chess is somehow different to that because of the huge number of possible starting arrays viewing all shuffled combinations. But during the history from Carrera to Bird, Capablanca [through to contemporary versions] it has been a point of critic and missing acceptance of that extended board. So it could not be counter productive to select special starting arrays which seem to be positionally better constructed, without reducing the huge number of possible initial positions too much.

That leads to the both new rules: a) placing Queen and Archbishop (Archangel) at different colored squares, and b) avoiding unprotected pawns. I cannot see any negative payload connected with this two additional demands. More then 20.000 possibilities should be sufficient.

Also see a nice SMIRF (providing both: FRC and CRC) preview at: http://www.chessbox.de/_tmp/SmirfPrototyp.png


Fischer Random Chess. Play from a random setup. (8x8, Cells: 64) (Recognized!)[All Comments] [Add Comment or Rating]
Reinhard Scharnagl wrote on Sun, Jan 9, 2005 11:46 PM UTC:
What is your goal, taa? Supposing you are intelligent I prosume you could
imagine that I notice that you are anonymously spreading desinformation
and nonsense here. Because the castlings like in Chess960 are not
symmetric, there is no redundance of mirrored positions. And CRC of course
is not trying to get as few as possible starting arrays, but instead to
filter positions, which eventually could be used as polemic arguments
against CRC, and to secure a more harmonic impression of that approach.

Shogi. The Japanese form of Chess, in which players get to keep and replay captured pieces. (9x9, Cells: 81) (Recognized!)[All Comments] [Add Comment or Rating]
Reinhard Scharnagl wrote on Thu, Jan 13, 2005 10:25 AM UTC:
If you want to see a more European look of Shogi, see:
http://f51.parsimony.net/forum203932/messages/21.htm

Arch-Chancellor Chess. Uses Archbishops instead of Bishops and Chancellors instead of Knights. (8x8, Cells: 64) [All Comments] [Add Comment or Rating]
Reinhard Scharnagl wrote on Thu, Jan 13, 2005 06:37 PM UTC:
Smirf would be able to play that variant except of the castling rule, where 8x8 pieces Q,R,B,N would be valid to promote into only.

Fischer Random Chess. Play from a random setup. (8x8, Cells: 64) (Recognized!)[All Comments] [Add Comment or Rating]
Reinhard Scharnagl wrote on Fri, Jan 14, 2005 12:59 PM UTC:
The CAPABLANCA-RANDOM-CHESS idea goes back to early 2004. One of the first
publishings of that idea has been made by me at July 1st, 2004 in 

http://www.bauer-schweitzer.de/forum/index.html

Reinhard Scharnagl wrote on Mon, Jan 17, 2005 05:55 PM UTC:
to David: thank you for your good wishes. I am about to do the first tests of the second Smirf program beta release. It is able to play Chess, Chess960, Capablanca Random Chess, Janus Chess and a lot more 8x8 and 10x8 variants (but claiming FCR/CRC are SUPERSETS, not variants).

Capablanca Random Chess. Randomized setup for Capablanca chess. (10x8, Cells: 80) [All Comments] [Add Comment or Rating]
💡📝Reinhard Scharnagl wrote on Fri, Feb 25, 2005 02:50 AM UTC:
To Greg Strong: of course you are right with your historical hints. There
might be some remarks to be added in the CRC description. The CRC text
should be extended, if there would be enough interested readers.

To Greg Strong and David Paulowich: indeed there are more traditional
names for C (Chancellor) and A (Archbishop). But those names do not
correspond to the pieces: nor to their gaits nor to their symbols. I have
tried to design more intuitive gait related symbols and noticed, that the
names would not be helpful for newcomers to the Capablanca extended piece
set. So I proposed names (partially already used differently in other
context) to enhance the readability of CRC board positions to interested
people. But that approach is only a suggestion, carefully keeping the same
initial letters e.g. to stay compatible within X-FEN.

To all posters here at CRC until now: thank you for your interest and
encouraging words!

💡📝Reinhard Scharnagl wrote on Sat, Feb 26, 2005 06:22 PM UTC:
To Larry Smith: I have asked some interested people to send me some icon proposals. They should be not too complicated, differ sufficiently from existing and be related to the pieces' gaits. But I have not got some really convincing. Nevertheless if one has an exiting idea ...

💡📝Reinhard Scharnagl wrote on Sun, Feb 27, 2005 10:50 PM UTC:
To Larry L. Smith: Well I know, that e.g. Shogi starts with three undefended pawns. Nevertheless the game has survived for long. But proposing new chess variants is mostly running against immense critic. So there are voices, which claims that most of the randomized positions were unplayable. I do not believe that at all, but I think it could help, to select just those positions, which are positionally more balanced. That lead to write down the additional rule of initially placing the Archbishop and Queen on different colored squares and to select only positions with all pawns defended. Of course this will reduce the genuine 48,000 possibilities to some more than 20,000. But this is still enough to avoid any creation of big opening libraries. So applying the rule might be skipped, but using it would help to make the variant more attractive to critic chess enthusiasts. Thus it has become part of my proposal.

💡📝Reinhard Scharnagl wrote on Sun, Feb 27, 2005 11:07 PM UTC:
To Greg Strong and Fergus Duniho: I have not awaited, that CRC would cause that quick your experiments to create those starting positions. Because of that I have not yet published a procedure, which would show how Smirf managed that problem and how to standardize the number to position relation. It obviously is not well known, that it has been me, who invented and introduced the numbering schema for Chess960. Beside of that numeric relation I have worked out a two table look up scheme which is fitting on to one single page to be used in chess clubs to have all Chess960 starting positions immediately at hands. For CRC a solution is of course not that easy. But if you are interested in that, I could post code snippets, where those positions are created from a given number. When Smirf is starting, it quickly creates an array of valid position numbers by probing all 48,000 and filtering the valid into an array of some more than 20,000 entries, what overmore allows to index those array with a short int, which is good for some pseudo random number generators, selecting later a randomized valid starting position. Another solution could be to use 6000 char constants, where the mass of 48,000 bits could be used to encode the precalculated validity of the appropriate number.

💡📝Reinhard Scharnagl wrote on Sun, Feb 27, 2005 11:57 PM UTC:
//=====================================
// CRC / Chess960 Position Generator
//=====================================
// reference implementation (C) 2005 by
// Reinhard Scharnagl, Munich, Germany
//=====================================

#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 istCRC = (nr <= 0);

  if (istCRC) {
    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, istCRC ? '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 = istCRC ? 10 : 8;
  char *pC = &FenZone[width];
  *pC++ = '/';
  for (pos = width; --pos >= 0; ) {
    *pC++ = 'p';
  }
  for (pos = 4; --pos >= 0; ) {
    *pC++ = '/';
    *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;
}

// test output
int main(void) {
  puts('first Chess960 positions');
  for (int nrFRC = 0; ++nrFRC <= 5; ) {
    puts(GetFen(nrFRC));
  }

  puts('first CRC positions');
  for (int nrCRC = 0; ++nrCRC <= 5; ) {
    puts(GetFen(-nrCRC));
  }

  return 0;
}

25 comments displayed

Earlier Reverse Order LaterLatest

Permalink to the exact comments currently displayed.