Closed DXPower closed 2 years ago
Thanks for the thoughtful additions and I definitely see how these would be useful, however I am avoiding breaking changes at this time. Also its much easier to accept simpler more orthogonal PRs than sweeping changes.
Trying to integrate this project into my own, I found what felt to be many missing features when trying to use the library. A lot of these were related to Moves and retrieving information easily, intuitively, and without unnecessary copies.
err
to(*Move, err)
. This is a breaking change to existing code that calls this function, however it is easily fixed by changing code fromerr := game.MoveStr("...")
to_, err := game.MoveStr("...")
. This is very useful for getting information about a move just made, such as the tags, promotion type, or piece moved (see next bullet)move_test.go
allowed for testing this. Other changes had to be made to the Engine and Decode to make sure this information is included whenever Moves are instantiated. In the future, this code can also be used to simplify the Encode and tests in many places.Moves()
and then performing your own index calculation on it. Even worse, if you want to get the piece moved in the last move, you must callPositions()
then get the same index as the move you got, then query themove.S1()
square of that position. With this combined with theMove.MovedPiece()
function, this action becomes trivial for a caller.Tests have also been updated to test and incorporate these functions.