Sorting-Algorithms-Visualizer
Sorting-Algorithms-Visualizer copied to clipboard
Added comments to main.py and removed hardcoded values from display.py to globals.py
Changes
- added comments to main.py to increase readability
- removed the hardcoded values from display.py (numBars, delay, time_taken, etc.) and moved them to globals.py
- imported hardcoded values from globals.py to display.py for usage
Why (resolves https://github.com/LucasPilla/Sorting-Algorithms-Visualizer/issues/176)
- Increases readability of code
- Makes code cleaner and more module
- Global definitions are easier to reuse across multiple modules
How
- Went through main.py to understand logic, then commented the file
- Created globals.py file, moved the hardcoded values from display.py over
- Imported the values from globals.py into display.py for usage throughout the file
Testing
- Ran the data visualizer again, confirmed that functionalities still operated the same as before (timer, switching sorting types, etc.)