Chess icon indicating copy to clipboard operation
Chess copied to clipboard

Chess feature

Open Incoherent-Code opened this issue 10 months ago • 0 comments

When Constructing the move class, you can use a starting and ending position instead of SAN:

new Move("e4","d5");

While this makes it really easy to input positions without really any work on the client, constructing a move that involves a promotion in this manner is impossible. Describe the solution you'd like A new constructor would be nice.

new Move("e4", "d5", PieceType.Rook);

Alternatively, it can be more like the internal constructor that does the same thing. https://github.com/Geras1mleo/Chess/blob/bc2c2b39debb2c647dbd39887ac5dd8ed4d9abf0/ChessLibrary/Types/Move.cs#L161

Describe alternatives you've considered There is still a way to do this with just the positions in the library using Board.Moves(). This is arguable safer since it always pulls from valid moves, but constructing and using Board.IsValidMove() should also be a valid way to use the library.

Move? move = Board.Moves().FirstOrDefault(move => move.Promotion == promotion && move.OriginalPosition == new Position(moves[0]) && move.NewPosition == new Position(moves[1]));

TYSM

Incoherent-Code avatar Feb 27 '25 01:02 Incoherent-Code