That's what I was thinking too. Imagine being in a FIDE sanctioned tournament and someone uses O instead of the official 0 and then you are disqualified from the $100,000 prize.bob wrote:I'd bet PGN pre-dates any fide spec. How can you tell if a hand-written score sheet uses 0's or O's or o's?syzygy wrote:It's not as if parsers can get away with ignore the "o-o" and (FIDE-suggested) "0-0" notations...Norm Pollock wrote:PGN-Standards:
http://www.saremba.de/chessgml/standard ... mplete.htm
8.2.3.3: Basic SAN move construction
...
SAN kingside castling is indicated by the sequence "O-O"; queenside castling is indicated by the sequence "O-O-O". Note that the upper case letter "O" is used, not the digit zero. The use of a zero character is not only incompatible with traditional text practices, but it can also confuse parsing algorithms which also have to understand about move numbers and game termination markers.
Assuming FIDE was already clear about castling being 0-0 at the time this was written up, it is at least unfortunate that FIDE's choice was ignored.Also note that the use of the letter "O" is consistent with the practice of having all chess move symbols start with a letter; also, it follows the convention that all non-pwn move symbols start with an upper case letter.
What world have I been in - castling notation?
Moderators: hgm, Rebel, chrisw
-
- Posts: 1612
- Joined: Fri Mar 01, 2013 5:28 pm
- Location: USA
Re: What world have I been in - castling notation?
"Without change, something sleeps inside us, and seldom awakens. The sleeper must awaken." (Dune - 1984)
Lonnie
Lonnie
-
- Posts: 5569
- Joined: Tue Feb 28, 2012 11:56 pm
Re: What world have I been in - castling notation?
Clearly any sensible interpretation of the FIDE rules allows both o-o and O-O in addition to 0-0.reflectionofpower wrote:That's what I was thinking too. Imagine being in a FIDE sanctioned tournament and someone uses O instead of the official 0 and then you are disqualified from the $100,000 prize.bob wrote:I'd bet PGN pre-dates any fide spec. How can you tell if a hand-written score sheet uses 0's or O's or o's?syzygy wrote:Assuming FIDE was already clear about castling being 0-0 at the time this was written up, it is at least unfortunate that FIDE's choice was ignored.
My point is that SAN specifically does NOT allow o-o and (FIDE-suggested) 0-0. It even goes through pains explaining why not.
-
- Posts: 4675
- Joined: Mon Mar 13, 2006 7:43 pm
FIDE? Ha ha ha
At the time that the SAN specification was developed, many different sources of information concerning chess notation were consulted, and of course the FIDE Laws were included.
The FIDE information about notation was incomplete, inconsistent, and ambiguous back then, and it still is today.
In some places, the FIDE Laws use zero with castling and in others they use the uppercase letter ""O". Also, there was plenty of variance in move notion in texts published under the FIDE imprimatur. There were a half dozen different ways of recording en passant moves. One of FIDE's problems is they made a misguided attempt to please everyone when what they really needed was a tyrant who would provide a unique move/notation mapping.
If you're really interested, then you can dig through the FIDE Laws and look for the castling references: http://www.fide.com/fide/handbook.html? ... ew=article
Those were the rules in effect twenty years ago; there have been some changes in just the past couple of months. But even so, the FIDE Laws are incomplete and still do not cover the case of when both file letter and rank number of the origin square are needed to disambiguate some moves.
Believe me, I've been through all of this many times. There are good reasons why SAN is the way it is.
--------
Oscar's SAN generator code:
Oscar's disambiguation code:
The FIDE information about notation was incomplete, inconsistent, and ambiguous back then, and it still is today.
In some places, the FIDE Laws use zero with castling and in others they use the uppercase letter ""O". Also, there was plenty of variance in move notion in texts published under the FIDE imprimatur. There were a half dozen different ways of recording en passant moves. One of FIDE's problems is they made a misguided attempt to please everyone when what they really needed was a tyrant who would provide a unique move/notation mapping.
If you're really interested, then you can dig through the FIDE Laws and look for the castling references: http://www.fide.com/fide/handbook.html? ... ew=article
Those were the rules in effect twenty years ago; there have been some changes in just the past couple of months. But even so, the FIDE Laws are incomplete and still do not cover the case of when both file letter and rank number of the origin square are needed to disambiguate some moves.
Believe me, I've been through all of this many times. There are good reasons why SAN is the way it is.
--------
Oscar's SAN generator code:
Code: Select all
static void SanRecLoadFromMove(SanRec * const sanrecptr, const Move move)
{
// This routine loads the given SAN record using the given move.
char *chptr = sanrecptr->chvec;
const Mc mc = GetMc(move);
const Man frman = GetFrMan(move);
const Man toman = GetToMan(move);
const Sq frsq = GetFrSq(move);
const Sq tosq = GetToSq(move);
SanRecReset(sanrecptr);
// Process according to the move's special case
switch (mc)
{
case McReg: // Regular move; no special case
if (IsManPawn(frman))
{
*chptr++ = MapSqToFileChar(frsq);
if (IsManNotVacant(toman))
{
*chptr++ = 'x';
*chptr++ = MapSqToFileChar(tosq);
};
*chptr++ = MapSqToRankChar(tosq);
}
else
{
*chptr++ = MapManToPieceChar(frman);
if (TestMf(move, MfAndf))
*chptr++ = MapSqToFileChar(frsq);
if (TestMf(move, MfAndr))
*chptr++ = MapSqToRankChar(frsq);
if (IsManNotVacant(toman))
*chptr++ = 'x';
*chptr++ = MapSqToFileChar(tosq);
*chptr++ = MapSqToRankChar(tosq);
};
break;
case McEPC: // En passant capture
*chptr++ = MapSqToFileChar(frsq);
*chptr++ = 'x';
*chptr++ = MapSqToFileChar(tosq);
*chptr++ = MapSqToRankChar(tosq);
break;
case McCQS: // Castles queenside
*chptr++ = 'O';
*chptr++ = '-';
*chptr++ = 'O';
*chptr++ = '-';
*chptr++ = 'O';
break;
case McCKS: // Castles kingside
*chptr++ = 'O';
*chptr++ = '-';
*chptr++ = 'O';
break;
case McPPN: // Pawn promotes to knight
case McPPB: // Pawn promotes to bishop
case McPPR: // Pawn promotes to rook
case McPPQ: // Pawn promotes to queen
*chptr++ = MapSqToFileChar(frsq);
if (IsManNotVacant(toman))
{
*chptr++ = 'x';
*chptr++ = MapSqToFileChar(tosq);
};
*chptr++ = MapSqToRankChar(tosq);
*chptr++ = '=';
*chptr++ = MapMcToPieceChar(mc);
break;
default:
break;
};
// Check and checkmate
if (TestMf(move, MfChck))
{
if (TestMf(move, MfMate))
*chptr++ = '#';
else
*chptr++ = '+';
};
*chptr++ = '\0';
}
Code: Select all
static void PositionNotateDisambiguation(const Position * const positionptr, const MoveSeg * const movesegptr)
{
// This routine notates disambiguation of the moves in the given move segment for the given position.
const Move * const baseptr = movesegptr->baseptr;
const ui limit = movesegptr->count;
ui index0;
Sq tosq;
Census census;
ui landings[SqLen];
CensusLoadFromBoard(&census, &positionptr->board);
for (tosq = SqA1; tosq <= SqH8; tosq++)
landings[tosq] = 0;
for (index0 = 0; index0 < limit; index0++)
landings[GetToSq(baseptr[index0])]++;
for (index0 = 0; index0 < limit; index0++)
{
const Move move0 = baseptr[index0];
const Man frman0 = GetFrMan(move0);
const Sq tosq0 = GetToSq(move0);
if ((landings[tosq0] > 1) && IsManQRBN(frman0) && (census.mancount[frman0] > 1))
{
const Sq frsq0 = GetFrSq(move0);
const File frfile0 = MapSqToFile(frsq0);
const Rank frrank0 = MapSqToRank(frsq0);
ui index1;
ui msc = 0, mfc = 0, mrc = 0;
for (index1 = 0; index1 < limit; index1++)
{
const Move move1 = baseptr[index1];
const Sq frsq1 = GetFrSq(move1);
if ((tosq0 == GetToSq(move1)) && (frman0 == GetFrMan(move1)) && (frsq0 != frsq1))
{
msc++;
if (MapSqToFile(frsq1) == frfile0)
mfc++;
if (MapSqToRank(frsq1) == frrank0)
mrc++;
};
};
if (msc > 0)
{
if ((mfc == 0) || (mrc > 0))
SetMf(movesegptr->baseptr[index0], MfAndf);
if (mfc > 0)
SetMf(movesegptr->baseptr[index0], MfAndr);
};
};
};
}
-
- Posts: 1612
- Joined: Fri Mar 01, 2013 5:28 pm
- Location: USA
Re: FIDE? Ha ha ha
I believe you. FIDE is still incomplete,inconsistent. Kasparov would have made a much better representative.sje wrote:At the time that the SAN specification was developed, many different sources of information concerning chess notation were consulted, and of course the FIDE Laws were included.
The FIDE information about notation was incomplete, inconsistent, and ambiguous back then, and it still is today.
};
}[/code]
"Without change, something sleeps inside us, and seldom awakens. The sleeper must awaken." (Dune - 1984)
Lonnie
Lonnie
-
- Posts: 5569
- Joined: Tue Feb 28, 2012 11:56 pm
Re: FIDE? Ha ha ha
They say 0-0 and 0-0-0.sje wrote:If you're really interested, then you can dig through the FIDE Laws and look for the castling references: http://www.fide.com/fide/handbook.html? ... ew=article
But you do agree that a move parser cannot get away with refusing to accept o-o and 0-0, right?Believe me, I've been through all of this many times. There are good reasons why SAN is the way it is.
OK, I just noticed:
Import format is somewhat more relaxed and it makes allowances for moves that do not conform exactly to the canonical format. However, these allowances may differ among different PGN reader programs.
-
- Posts: 4675
- Joined: Mon Mar 13, 2006 7:43 pm
Re: FIDE? Ha ha ha
You missed some of the FIDE castling references; try again.syzygy wrote:They say 0-0 and 0-0-0.sje wrote:If you're really interested, then you can dig through the FIDE Laws and look for the castling references: http://www.fide.com/fide/handbook.html? ... ew=article
But you do agree that a move parser cannot get away with refusing to accept o-o and 0-0, right?Believe me, I've been through all of this many times. There are good reasons why SAN is the way it is.
A parser has no responsibility to accept anything other than what the standard says it should accept.
-
- Posts: 5569
- Joined: Tue Feb 28, 2012 11:56 pm
Re: FIDE? Ha ha ha
Sure!sje wrote:A parser has no responsibility to accept anything other than what the standard says it should accept.
And so much for real-world usability.
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: What world have I been in - castling notation?
There is two parts to this issue. The standard should be specific and precise. That's true for any specification as is taught in any software engineering course. Whether you choose to be draconian or relaxed when you actually parse moves is a completely separate issue.syzygy wrote:Clearly any sensible interpretation of the FIDE rules allows both o-o and O-O in addition to 0-0.reflectionofpower wrote:That's what I was thinking too. Imagine being in a FIDE sanctioned tournament and someone uses O instead of the official 0 and then you are disqualified from the $100,000 prize.bob wrote:I'd bet PGN pre-dates any fide spec. How can you tell if a hand-written score sheet uses 0's or O's or o's?syzygy wrote:Assuming FIDE was already clear about castling being 0-0 at the time this was written up, it is at least unfortunate that FIDE's choice was ignored.
My point is that SAN specifically does NOT allow o-o and (FIDE-suggested) 0-0. It even goes through pains explaining why not.
My take is that people should follow the standard, but one should always realize that there are idiots that won't follow the standard and one should do whatever practical to make up for any deficiencies found, when possible, and then encourage the idiot to fix his stuff to actually comply with the standard.
Most seem to get the ranks, files and pieces right. But zero vs oh, and then en passant captures promotions are the next hurdle. And some can't even figure out where spaces are appropriate.
-
- Posts: 5569
- Joined: Tue Feb 28, 2012 11:56 pm
Re: What world have I been in - castling notation?
The standard could precisely specify that a parser shall be able to deal with 0-0, o-o and O-O...bob wrote:There is two parts to this issue. The standard should be specific and precise. That's true for any specification as is taught in any software engineering course.
-
- Posts: 589
- Joined: Tue Jun 04, 2013 10:15 pm
Re: What world have I been in - castling notation?
In that case you get the $1OO,OOO prize.reflectionofpower wrote:Imagine being in a FIDE sanctioned tournament and someone uses O instead of the official 0 and then you are disqualified from the $100,000 prize.
[Account deleted]