public void DoGameTurn() { DoMove(); //If new move is replacing previous move without redo if (GameBoard.TurnCounter != GameBoard.TempTurnCounter && !IsNextMoveRedo) { MoveHistory.RemoveAll(item => { int index = MoveHistory.IndexOf(item); return(index > GameBoard.TempTurnCounter - 1); }); GameBoard.TurnCounter = GameBoard.TempTurnCounter; } //If redo move replayed if (IsNextMoveRedo) { GameBoard.TempTurnCounter += 1; IsPlayerWTurn = (GameBoard.TempTurnCounter % 2 != 1); } //If standard move else { GameBoard.TurnCounter += 1; GameBoard.TempTurnCounter = GameBoard.TurnCounter; IsPlayerWTurn = (GameBoard.TurnCounter % 2 != 1); MoveHistory.Add(new List <int>(Move)); } IsNextMoveRedo = false; if (IsGameEndTriggered(GameBoard.GameArray)) { } }