Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Ambiguous moves in algebraic notation

Author: Russell Reagan

Date: 15:58:03 06/28/02

Go up one level in this thread


On June 28, 2002 at 05:26:20, Sven Reichard wrote:

>I do a similar thing. I have the following class (a bit simplified and written
>from memory):
>
>class SanNotation
>{
>public:
>  SanNotation(const Game&, const Move*);
>  SanNotation(const Game&, const std::string&);
>
>  const Move* getMove() const;
>  const std::string getString() const;
>private:
>  // <snip>
>};

Do you have a Game class and a Position class? Or is there no position structure
and only a game structure?

>This class allows conversion from text to move and vice versa. I use it only
>when I actually read/write moves, so the execution speed is not crucial. When
>building the string, I generate all pseudolegal moves and check if, e.g., Ne5
>uniquely determines the move in question. If that fails, I try adding the file,
>then the rank, then both, until I get a unique move.
>
>The only problem arises for promoting moves, because here you have (or at least
>I have) 4 moves with the same source square. I haven't found an elegant solution
>for this yet; currently, after counting the matching moves in this case, I
>divide the number by 4.
>
>The other direction is more straighforward and stupid: Generate all moves, find
>their SAN string, and see which one fits. This depends on totally standard
>conforming input, but for now it works.
>
>Sven.

Thanks for the info. These will be very helpful.

Russell



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.