iigorr / pgn.net

Portable Game Notation (PGN) implementation in .NET
Other
33 stars 24 forks source link

Move.Piece difference between simple move and capture #15

Closed Antaniserse closed 9 years ago

Antaniserse commented 9 years ago

Hello, Unless i'm doing something wrong, it seems that, when the current move is a pawn move, the value of Move.Piece is handled differently whether the move is simple or is a capture.

Simple move: Move.Piece == PieceType.Pawn Capture: Move.Piece == nil

Is this intended?

Sample PGN

[Event "Portorose"]
[Site "?"]
[Date "1958.??.??"]
[Round "8"]
[White "Fischer, R."]
[Black "Larsen, B."]
[Result "*"]

1. e4 c5 2. Nf3 d6 3. d4 cxd4 *
iigorr commented 9 years ago

Hi Antaniserse,

I think you are right. The only thing I might have been thinking here is that as long as the move is unambiguous (single piece on a file) you could leave out the piece letter. E.g an empty c file and then ...20. Bc3 Kf3xd4 21. cxd4 (Bishop takes Knight) ...

But the spec is actually pretty clear about this.

8.2.3.3: Basic SAN move construction

A basic SAN move is given by listing the moving piece letter (omitted for pawns) followed by the destination square. [...]

http://www.saremba.de/chessgml/standards/pgn/pgn-complete.htm#c8.2.3

I'm gonna fix this.