-
Notifications
You must be signed in to change notification settings - Fork 0
GUI for the Problems
For the GUI pygame
library was chosen due to prior experience of using this library.
Pygame is a good choice for simple visuals due to it's power and ease of use.
As you can see in the project, each problem with visuals has a main.py
file, which stores the Game/Visualization
class. This is a simple pre-written body from my previous game projects and it suits here perfectly.
Generally in pygame
the screen has to be updated every call of the update()
function in my Game/Visualization
body. However, because the solve()
functions in every algorithm work as a whole, I couldn't call update()
every step of the algorithm. That is why I had to add a new parameter vizual=None
to every problem's class. The whole Game/Visualization
class is passed to the visual
variable and if it is there, in the solve function we have:
if self.vizual:
update_screen()
which makes the GUI update on every important step.
This structure allows each algorithm to be used without the GUI for various problems where GUI is not needed.