import sorting_algorithms, time, os, sys
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame

dimensions = (1024, 512)  # The y value should be equal to the array length
algorithms = {"SelectionSort": sorting_algorithms.SelectionSort(), \
              "BubbleSort": sorting_algorithms.BubbleSort(), \
              "InsertionSort": sorting_algorithms.InsertionSort(), \
              "ShellSort": sorting_algorithms.ShellSort(), \
              "RadixSort": sorting_algorithms.RadixSort(), \
              "CocktailSort": sorting_algorithms.CocktailSort(), \
              "GnomeSort": sorting_algorithms.GnomeSort(), \
              "MergeSort": sorting_algorithms.MergeSort(), \
              "QuickSort": sorting_algorithms.QuickSort(), \
              "HeapSort": sorting_algorithms.HeapSort(), \
              "BitonicSort": sorting_algorithms.BitonicSort(), \
              "BucketSort": sorting_algorithms.BucketSort()}

if len(sys.argv) > 1:
    if sys.argv[1] == "list":
        for key in algorithms.keys():
            print(key, end=" ")
        print("")
        sys.exit(0)

# Pygame Initialisation
pygame.init()
display = pygame.display.set_mode((dimensions[0], dimensions[1]))
display.fill(pygame.Color("white"))
cutoff = False, max_values[0] = 1000, step = 1
"""
import sorting_algorithms, time, csv, os, sys, math

os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame

# Sorting Algorithm Variables
cutoff = False  # If true sorting algorithms above graph will no longer be used for sorting
# This is good for large max values as sorting will only be done by more efficient algorithms
# Note - this will make the max and min values only based on the current times for algorithms still in use
iterations = 10  # Amount of results incuded in average values
step = 1  # Step between each length of the array
algorithms = [sorting_algorithms.SelectionSort(), sorting_algorithms.BubbleSort(), sorting_algorithms.InsertionSort(), sorting_algorithms.ShellSort(), \
              sorting_algorithms.RadixSort(), sorting_algorithms.CocktailSort(), sorting_algorithms.GnomeSort(), sorting_algorithms.MergeSort(), \
              sorting_algorithms.QuickSort(), sorting_algorithms.HeapSort(), sorting_algorithms.BucketSort()]
off_graph = [
    False
] * 11  # Array of booleans to check if algorithms are off the graph

# Graph Variables
window = (1920, 800)  # Window size
dimensions = (1800, 800)  # Graph size
padding = 80  # Padding of axis from side of window
text_padding = 40  # Padding from axis to text
scale_padding = 10  # Padding from axis to scale
legend_padding = 20  # Padding between legend keys
legend_square_padding = 20  # Padding between the colour square and legend text
legend_square_size = 15  # Size of colour square size
pnt_size = 3  # Size of the point representing each measurement
scale_font_size = (