Skip to content

Commit

Permalink
Update settings.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jian-li1 authored Mar 11, 2023
1 parent 5e4dd76 commit e0a2db1
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,28 @@
#[i for i in range(1, RECT_WIDTH + RECT_SPACING + 1) if (RECT_WIDTH + RECT_SPACING) % i == 0]

# Initialize variables for keeping track of the program's status
sorting = threading.Event() # Is set when sorting operation is active
playing = threading.Event() # Is set when sorting operation is being played
swapping = threading.Event() # Is set when swapping is being animated
btn_animate = threading.Event() # Is set when user hovers over a button; animates color change of the button
status = {
'sorting': False, # Is set when sorting operation is active
'playing': threading.Event(), # Is set when sorting operation is being played
'swapping': False, # Is set when swapping is being animated
'moving': False, # Is set when rectangle is moving up or down
'sub_sorting': False, # Is set when sorting sub arrays during merge sort
'merging': False, # Is set when merging is being animated
'btn_animate': False # Is set when user hovers over a button; animates color change of the button
}

# Speed adjust and delay of sorting
class Speed():
adjust = len(PIXEL_CHANGE) // 3
delay = (RECT_WIDTH + RECT_SPACING) / PIXEL_CHANGE[adjust] / FPS['idle'] / 60 * FPS['idle']

# Pivot line for quick sorting
quick_sort_line = {'start': None, 'end': None}
# Infomation for swapping two rectangles: both rectangles' index in the array and their positions (x coordinates)
swap_rect = {'rect1': None, 'rect1_pos': None, 'rect2': None, 'rect2_pos': None}
# Information for moving two rectangles for merge sorting
sub_sort = {'rect': None, 'rect_x_pos': None, 'rect_pos_dest': None}
merge_rect = [None, None]

# Selected algorithm
selected = {'alg': None, 'function': None}
selected = {'alg': None, 'text': '', 'function': None}

0 comments on commit e0a2db1

Please sign in to comment.