private void visualizeAction(int index, bool prev = false)
        {
            SortAction action = actions[index];

            if (action.type == ActionType.Compare)
            {
                resetOldEffect();
                colorEffect(action.indexes[0], action.indexes[1], compareColor, compareColor);
            }
            else if (action.type == ActionType.PreSwap && prev == false)
            {
                resetOldEffect();
                colorEffect(action.indexes[0], action.indexes[1], swap1Color, swap2Color);
            }
            else if (action.type == ActionType.Swap)
            {
                swapEffect(action.indexes[0], action.indexes[1], prev);
                actionIndex += prev ? -1 : 1;
            }
            else if (action.type == ActionType.PostSwap && prev)
            {
                resetOldEffect();
                colorEffect(action.indexes[0], action.indexes[1], swap2Color, swap1Color);
            }
            else if (action.type == ActionType.Empty)
            {
                resetOldEffect();
            }
            oldEffect.AddRange(action.indexes);
        }
 public void addAction(SortAction action)
 {
     if (action.type == ActionType.Swap)
     {
         actions.Add(new SortAction()
         {
             type = ActionType.PreSwap, indexes = action.indexes
         });
         actions.Add(action);
         actions.Add(new SortAction()
         {
             type = ActionType.PostSwap, indexes = action.indexes
         });
     }
     else
     {
         actions.Add(action);
     }
 }