|
Main
Date: 02 Oct 2006 01:47:10
From: Folkert van Heusden
Subject: parsing short algebraic notation
|
Hi, Does anyone know of any SAN-encoded moves parsing code? In Java or C/C++? That is released so that I can incorporate it into other code? Which is also readable for people that did not have an intimate relation with the writer? Folkert. (I mean code that parses 'Nc3' into 'b1-c3')
|
|
|
Date: 02 Oct 2006 17:38:25
From: Anders Thulin
Subject: Re: parsing short algebraic notation
|
Folkert van Heusden wrote: > (I mean code that parses 'Nc3' into 'b1-c3') Ok, so it's not so much parsing as conversion that you're after. Look for the SAN Toolkit -- I'm fairly certain you can use it to convert short notation into long notation, though possibly with a little coding of your own. Even so, as long as you have a routine that lists all legal moves from a given position, you should fairly easily be able to do the conversion based on that. -- Anders Thulin ath*algonet.se http://www.algonet.se/~ath
|
| |
Date: 02 Oct 2006 23:33:15
From: Folkert van Heusden
Subject: Re: parsing short algebraic notation
|
>> (I mean code that parses 'Nc3' into 'b1-c3') > Ok, so it's not so much parsing as conversion that you're after. Well, yeah, kinda. > Look for the SAN Toolkit -- I'm fairly certain you can use it to > convert short notation into long notation, though possibly with a > little coding of your own. > Even so, as long as you have a routine that lists all legal moves > from a given position, you should fairly easily be able to do > the conversion based on that. Hmmm, that's rather unfortunate. I wanted to keep as much chess knowledge OUT of autoplay as possible.
|
| | |
Date: 03 Oct 2006 11:51:12
From: David Richerby
Subject: Re: parsing short algebraic notation
|
Folkert van Heusden <[email protected] > wrote: >> Even so, as long as you have a routine that lists all legal moves >> from a given position, you should fairly easily be able to do >> the conversion based on that. > > Hmmm, that's rather unfortunate. I wanted to keep as much chess > knowledge OUT of autoplay as possible. You can't avoid it. Consider, for example, the position White: Kc1, Nb1, Nd1 Black: Kh1, Qa1 8/8/8/8/8/8/8/qNKN3k w - - 0 1 Here, the specification of SAN in the PGN standard says that the correct SAN for the move Nd1-c3 is just ``Nc3''. Because the move Nb1-c3 is illegal, there's no need to disambiguate between Nbc3 and Ndc3. Likewise, if we add another black queen on e1 and a white knight on d5 8/8/8/3N4/8/8/8/qNKNq2k w - - 0 1 the move Nc3 is still unambiguous but now means Nd5-c3. It isn't relevant to your query but, along the same lines, it's worth noting that you're not supposed to use [discovered] check to disambiguate. So, in the position White: Kh1, Qa1, Nb1, Nd1 Black: Kc1 8/8/8/8/8/8/8/QNkN3K w - - 0 1 the correct way to denote the knight moves Nb1-c3+ and Nd1-c3 is Nbc3+ and Ndc3, not Nc3+ and Nc3. Dave. -- David Richerby Revolting Drink (TM): it's like a www.chiark.greenend.org.uk/~davidr/ refreshing juice beverage but it'll turn your stomach!
|
| | |
Date: 03 Oct 2006 10:24:58
From: Anders Thulin
Subject: Re: parsing short algebraic notation
|
Folkert van Heusden wrote: > Hmmm, that's rather unfortunate. I wanted to keep as much chess knowledge > OUT of autoplay as possible. And you think knowledge of legal moves is not the minimum knowledge you are looking for, for expanding short notation. Well ... good luck with your search. -- Anders Thulin ath*algonet.se http://www.algonet.se/~ath
|
|