Sorting-Algorithms-Visualizer icon indicating copy to clipboard operation
Sorting-Algorithms-Visualizer copied to clipboard

Added comments to main.py and removed hardcoded values from display.py to globals.py

Open hlai1 opened this issue 1 year ago • 0 comments

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.)

hlai1 avatar Dec 08 '23 16:12 hlai1