Run the python tests in a Python container using a custom local action
and a Dockerfile to build the testing environment.
Resolves the issue where setup-python doesn't seem to work with Forgejo
actions (at least for me anyway).
This commit adds a simple side panel to allow users to interact with the
application. The side panel allows the user to:
- Generate and regenerate mazes
- Choose between the searching algorithms
- Choose whether or not to add randomness to the algorithm
- Run and re-run the simulation
Update the DFS algorithm to allow the user to select if the solver
should randomly choose the directions when traversing through the maze.
The duplicate method has been removed.
Implement a variation to the DST search algorithm to the Solver class.
In this variation, the solver randomly chooses the next direction when
it reaches a fork in its path.
Create a separate class to represent the solver of the maze.
Additional search algorithms will be implemented here.
Additional changes:
- Add public methods to mark cells as visited and to get results of
the visits.
- Renamed MazeDirections to MazeDirection.
- Renamed _num_cell_rows to _height.
- Renamed _num_cells_per_row to _width.
- Created a dedicated method to configure a cell's walls in the Maze
class.
- created a dedicated public method to draw a path between two cells in
the Maze class.
- Created a new enum type called MazeDirections to represent the
directions you can make in the maze.
- Created a class called MazePosition to represent the position on the
maze grid. It has the functionality to calculate and return adjacent
positions.
- Used the above two additions to refactor the _break_walls_r method and
make it a bit easier to read.
- Fixed the issue where during the reconfiguration of the walls of a
cell, those that weren't being reconfigured were reset to True
regardless of their previous configuration.
- During testing, don't run the _break_walls_r method because it will
run into the RecursionError exception.
- Simplify the code for drawing cells and fix the redrawing wasn't
applied properly.
When the Maze Solver was idle the wait_for_close() loop ran which
continuously redrew the window in an infinite while loop. This caused
the CPU usage to spike between 70%-80%. This commit removes that method
and uses the _root.mainloop() instead to keep the window visible on the
screen. With this the CPU usage has dropped to > 1% when idle.
Main feature:
- Added functionality to randomly generate a maze before the solver
solves it.
Fixes:
- Add a public method in the Cell class called wall_exists() that
returns true if a given cell wall exists (false otherwise).
Refactors:
- Added an enum type called CellWallLabel for labelling the four cell
walls.
- Added a draw() function in the CellWall class to reduce repeated code.
- Move the custom exceptions to errors.py
Tests:
- Add tests for the custom exceptions.
CI:
- Added a workflow for Forgejo Actions.
- Raise CellInvalidError when attempting to specify the wrong corners of
the cell when creating it. The x and y values should always represent
the top left and bottom right corners of the cell.
- Raise CellTooSmallError when attempting to specify a cell which is too
small to correctly draw its central point.
- Add an entrance and exit to the maze. The entrance will always
be on the top left and the exit will always be on the bottom
right.
- Add a simple GitHub actions workflow to run the Python tests.
Optionally pass in the reference of the Window to the Maze and
Cell classes, and only draw the graphics if the reference exists.
Use a single underscore instead of the double underscore for private
Class members.