fixes lol
Some checks failed
Build and Push / build-all (push) Failing after 58s

This commit is contained in:
doomtube 2026-01-08 01:45:13 -05:00
parent 7916294943
commit c13210e5ed
2 changed files with 11 additions and 7 deletions

View file

@ -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
)

View file

@ -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
}