// Analyseert de lijst en voert bijbehorende commando's uit.
        private static void AnalyseAndPerformActions(List <string> commandList)
        {
            for (var i = 0; i < commandList.Count; i++)
            {
                switch (commandList[i])
                {
                case "fd":
                case "forward":
                    Turtle.Move(GetNextNumber(i, commandList));
                    UpdatePositionVariables();
                    i += lengthOfNumericalInput;
                    break;

                case "bk":
                case "backward":
                    Turtle.Move(-GetNextNumber(i, commandList));
                    UpdatePositionVariables();
                    i += lengthOfNumericalInput;
                    break;

                case "rt":
                case "turn":
                    Turtle.Turn(GetNextNumber(i, commandList));
                    variables["angle"] = Turtle.Angle;
                    i += lengthOfNumericalInput;
                    break;

                case "lt":
                    Turtle.Turn(-GetNextNumber(i, commandList));
                    variables["angle"] = Turtle.Angle;
                    i += lengthOfNumericalInput;
                    break;

                case "wait":
                    System.Threading.Thread.Sleep((int)System.Math.Round(GetNextNumber(i, commandList) * 1000 / 60));
                    i += lengthOfNumericalInput;
                    break;

                case "speed":
                    Turtle.Speed       = GetNextNumber(i, commandList);
                    variables["speed"] = Turtle.Speed;
                    i += lengthOfNumericalInput;
                    break;

                case "msg":
                case "message":
                case "print":
                    if (i + 1 < commandList.Count)
                    {
                        TextWindow.WriteLine(RemoveBrackets(commandList[i + 1]));
                        i++;
                    }
                    else
                    {
                        ThrowException(5);
                    }
                    break;

                case "line":
                    SplitMultiNumberList(i, commandList, 4);

                    GraphicsWindow.DrawLine(multiNumberList[0], multiNumberList[1], multiNumberList[2], multiNumberList[3]);
                    i++;
                    break;

                case "setpos":
                    SplitMultiNumberList(i, commandList, 2);
                    Turtle.X = multiNumberList[0];
                    Turtle.Y = multiNumberList[1];
                    UpdatePositionVariables();
                    i++;
                    break;

                case "setpc":
                    SplitMultiNumberList(i, commandList, fromPenColor: true);

                    GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(
                        multiNumberList[0], multiNumberList[1], multiNumberList[2]);
                    i++;
                    break;

                case "setbc":
                    SplitMultiNumberList(i, commandList);

                    GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(
                        multiNumberList[0], multiNumberList[1], multiNumberList[2]);
                    i++;
                    break;

                case "hide":
                case "hideturtle":
                case "ht":
                    Turtle.Hide();
                    turtleIsHidden = true;
                    break;

                case "show":
                case "showturtle":
                case "st":
                    if (turtleIsHidden)
                    {
                        Turtle.Show();
                    }

                    turtleIsHidden = false;
                    break;

                case "pu":
                case "penup":
                    Turtle.PenUp();
                    break;

                case "pd":
                case "pendown":
                    Turtle.PenDown();
                    break;

                case "file":
                    if (i + 1 < commandList.Count)
                    {
                        DrawFromFile(RemoveBrackets(commandList[i + 1]));
                        i++;
                    }
                    else
                    {
                        ThrowException(5);
                    }
                    break;

                case "setorientation":
                    Turtle.Angle       = GetNextNumber(i, commandList);
                    variables["angle"] = Turtle.Angle;
                    i += lengthOfNumericalInput;
                    break;

                case "setpx":
                case "setpixel":
                    SplitMultiNumberList(i, commandList, 2);

                    GraphicsWindow.SetPixel(multiNumberList[0], multiNumberList[1], GraphicsWindow.PenColor);
                    i++;
                    break;


                case "repeat":
                    i += RepeatCommands(i, commandList);
                    break;

                case "for":
                    ForLoop(i, commandList);
                    i += 2;
                    break;

                case "while":
                    WhileLoop(i, commandList);
                    i += 2;
                    break;

                case "circle":
                    int circleRadius = (int)GetNextNumber(i, commandList);
                    GraphicsWindow.DrawEllipse(Turtle.X - circleRadius, Turtle.Y - circleRadius, circleRadius * 2, circleRadius * 2);
                    i += lengthOfNumericalInput;
                    break;

                case "cs":
                    ResetTurtle();
                    break;

                case "ct":
                    TextWindow.Clear();
                    break;

                case "help":
                    PrintHelp();
                    break;

                case "if":
                    i += CompareInputs(i, commandList);
                    break;

                case "make":
                    AddVariable(i, commandList);
                    i += lengthOfNumericalInput + 1;
                    break;

                case "to":
                    i += ToCommandBase(i, commandList) + 2;
                    break;

                default:
                    if (toShortcuts.ContainsKey(commandList[i]))
                    {
                        AnalyseAndPerformActions(toShortcuts[commandList[i]]);
                    }
                    else if (commandList[i].StartsWith(":"))
                    {
                        TextWindow.WriteLine(GetNextNumber(i, commandList, 0));
                        i += lengthOfNumericalInput - 1;
                    }
                    else
                    {
                        ThrowException(0, commandList[i]);
                    }
                    break;
                }
            }
        }