nvzqz / Sage

A cross-platform chess library for Swift
Apache License 2.0
373 stars 43 forks source link

How to get captured piece after a move? #6

Closed cesarvarela closed 8 years ago

cesarvarela commented 8 years ago

First of all, awesome work you have here!

Now, how do I get the captured piece after a move?

I've been looking at the move history, but I wonder if you though about an easier way.

nvzqz commented 8 years ago

There currently isn't a way to get the captured piece from the last executed move. I'll definitely add this functionality!

What you can do, however is check for a change with capturedPieces(for:). There's also checking the piece at move.end before the move but that won't take en passant into account.

nvzqz commented 8 years ago

Done afa841e32b3239588ce4e92591b62a57c6e57b50

nvzqz commented 8 years ago

New release with this change: v2.3.0