in reply to Parsing Chess Algebra Notation
The last character may or may not be a '+', indicating check. (I'm going to assume that there is no analysis on the game, so I will ignore !, !!, ?, ??, ?!, and !?.) So, we have to see if that exists. If it does, we may or may not want to verify that, after the move, a state of check exists.
After we look for the '+', the last two characters are guaranteed to be the destination square in the form /[a-h][1-8]/.
Any remaining characters are the specification for the piece and/or starting-square coordinates. (Remember, we're still parsing the string in reverse.)
The key is parsing it backwards.
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Parsing Chess Algebra Notation
by EdwardG (Vicar) on May 04, 2004 at 16:35 UTC | |
by halley (Prior) on May 04, 2004 at 16:55 UTC | |
by podian (Scribe) on May 04, 2004 at 20:03 UTC | |
by EdwardG (Vicar) on May 04, 2004 at 17:08 UTC | |
by dragonchild (Archbishop) on May 04, 2004 at 17:28 UTC | |
by EdwardG (Vicar) on May 04, 2004 at 17:41 UTC | |
| |
by rir (Vicar) on May 04, 2004 at 20:01 UTC | |
|
Re: Re: Parsing Chess Algebra Notation
by cyocum (Curate) on May 07, 2004 at 14:05 UTC | |
by dragonchild (Archbishop) on May 07, 2004 at 15:22 UTC |