From c13210e5ed94183806079a2ec8c1b735cbf4589a Mon Sep 17 00:00:00 2001 From: doomtube Date: Thu, 8 Jan 2026 01:45:13 -0500 Subject: [PATCH] fixes lol --- nakama/go-modules/go.mod | 2 +- nakama/go-modules/main.go | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/nakama/go-modules/go.mod b/nakama/go-modules/go.mod index 3db527a..b62bc8c 100644 --- a/nakama/go-modules/go.mod +++ b/nakama/go-modules/go.mod @@ -4,5 +4,5 @@ go 1.22 require ( github.com/heroiclabs/nakama-common v1.44.0 - github.com/corentings/chess/v2 v2.0.1 + github.com/corentings/chess/v2 v2.3.3 ) diff --git a/nakama/go-modules/main.go b/nakama/go-modules/main.go index b0e6e5b..0034184 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) - // Find the move and get its algebraic notation - var algebraicMove string + // Verify move is valid first + found := false for _, move := range game.ValidMoves() { if move.S1().String() == from && move.S2().String() == to { // Check promotion @@ -748,17 +748,21 @@ func validateChessMove(fenStr, from, to, promotion string) MoveResult { continue } } - algebraicMove = move.String() + found = true break } } - if algebraicMove == "" { + if !found { return result } - // Make the move using algebraic notation - if err := game.PushMove(algebraicMove); err != nil { + // Make the move using UCI notation (e.g., "e2e4" or "e7e8q") + uciMove := from + to + if promotion != "" { + uciMove += promotion + } + if err := game.PushNotationMove(uciMove, chess.UCINotation{}, nil); err != nil { return result }