lichess-org / dartchess

Dart chess library for native platforms
https://pub.dev/packages/dartchess
GNU General Public License v3.0
33 stars 17 forks source link

Implement Position.parseSAN #4

Closed veloce closed 1 year ago

veloce commented 1 year ago

We need the ability to parse SAN for a Position.

Implement a method in Position class, whose signature is Move? parseSAN(String san). The move returned should be a legal move of the position, if any.

It should support crazyhouse and drop moves too.

Example implementation on: https://github.com/niklasf/chessops/blob/f287455e1cc83925c9f759f3c8829e2ca89d243f/src/san.ts#L82

dignissimus commented 1 year ago

How should ambiguities be handled? What about move annotations?

veloce commented 1 year ago

You mean annotation like in a PGN format? This should be handled by the PGN parser.

Here it should only parse SAN according to a Position (see corresponding class). Returned move should be a legal move according to that position or null (so there's no ambiguities).