diff --git a/nakama/go-modules/main.go b/nakama/go-modules/main.go index ef79c56..b0e6e5b 100644 --- a/nakama/go-modules/main.go +++ b/nakama/go-modules/main.go @@ -736,8 +736,8 @@ func validateChessMove(fenStr, from, to, promotion string) MoveResult { game := chess.NewGame(fen) - // Verify the move is valid first - found := false + // Find the move and get its algebraic notation + var algebraicMove string for _, move := range game.ValidMoves() { if move.S1().String() == from && move.S2().String() == to { // Check promotion @@ -748,21 +748,17 @@ func validateChessMove(fenStr, from, to, promotion string) MoveResult { continue } } - found = true + algebraicMove = move.String() break } } - if !found { + if algebraicMove == "" { return result } - // Make the move using UCI notation (e.g., "e2e4" or "e7e8q" for promotion) - uciMove := from + to - if promotion != "" { - uciMove += promotion - } - if err := game.PushNotationMove(uciMove, chess.UCINotation{}, nil); err != nil { + // Make the move using algebraic notation + if err := game.PushMove(algebraicMove); err != nil { return result }