Closed ArmanMaesumi closed 4 years ago
I would like to use this Go library for an AlphaBeta pruning look ahead algorithm, but I don't understand how to neatly undo a move. Say we pushed a move to a game like so
game := chess.NewGame() moves := game.ValidMoves() game.Move(moves[0])
How can we then undo the last move that was made?
You can use the position.Update method to move from valid moves directly and skip redundant validation: https://godoc.org/github.com/notnil/chess#Position.Update
Hope this helped.
I would like to use this Go library for an AlphaBeta pruning look ahead algorithm, but I don't understand how to neatly undo a move. Say we pushed a move to a game like so
How can we then undo the last move that was made?