nvzqz / Sage

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

Fixed issue in `Game` copying #14

Closed Hengyu closed 7 years ago

Hengyu commented 7 years ago

I don't know whether it is deliberate for not adding the code self.enPassantTarget = game.enPassantTarget. But not adding this line will cause the following issue:

Let's suppose a game A is in an "En Passant" state, that is, the next player who moves the piece can make an en passant move. Apparently, calling myGame.isLegal(move: myEnPassantMove) will return true. But if we call myGame.copy().isLegal(move: myEnPassantMove), it will return false which is not act as "expected".

nvzqz commented 7 years ago

This was most likely an oversight. Thanks for catching it!