Closed museum-future closed 4 years ago
@museum-future you can use my library to take a list of legal moves in given position: https://github.com/perechnev/ChessKit
Hi @museum-future
Yes, there is a method on Board
called possibleMoveLocationsForPiece(atLocation:)
which returns an array of BoardLocation
s.
Here is a code snippet from my own chess game:
if let selectedIndex = selectedIndex {
let selectedLocation = BoardLocation(index: selectedIndex)
boardView.possibleMovesView.locations = game.board.possibleMoveLocationsForPiece(atLocation: selectedLocation)
}
Hope that helps!
Is there a painless way to display a green circle on the board to show legal moves once a piece is touched?