From 5df43b95398f4084515d411766c53bf6be0c22a1 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Thu, 25 Jul 2024 09:41:36 -0700 Subject: [PATCH] Fix crash when moving checker backwards --- game.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/game.go b/game.go index 020cd42..2253085 100644 --- a/game.go +++ b/game.go @@ -425,12 +425,14 @@ ADDMOVES: } gameMove := gameCopy.Moves[i] if move[0] == gameMove[1] && move[1] == gameMove[0] { - copy(gameCopy.Board, gameCopy.boardStates[i]) - gameCopy.Player1.Entered = gameCopy.enteredStates[i][0] - gameCopy.Player2.Entered = gameCopy.enteredStates[i][1] - gameCopy.boardStates = gameCopy.boardStates[:i] - gameCopy.enteredStates = gameCopy.enteredStates[:i] gameCopy.Moves = gameCopy.Moves[:i] + if !local { + copy(gameCopy.Board, gameCopy.boardStates[i]) + gameCopy.Player1.Entered = gameCopy.enteredStates[i][0] + gameCopy.Player2.Entered = gameCopy.enteredStates[i][1] + gameCopy.boardStates = gameCopy.boardStates[:i] + gameCopy.enteredStates = gameCopy.enteredStates[:i] + } continue } }