Commit graph

13 commits

Author SHA1 Message Date
1b0f044834
feat: add a side panel for user interaction
Some checks failed
test / test (pull_request) Failing after 6s
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
2024-02-18 08:53:36 +00:00
a091f0a68d
refactor: add a dedicated class for the solver
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.
2024-02-16 23:27:09 +00:00
5c48f47a0a
feat: add the algorithm to solve the maze 2024-02-15 22:34:08 +00:00
a8ef152847
fix: create a separate visited variable for solver
- Create a new visited variable for the Maze solver.
- Rename the existing visited variable to
  visited_by_maze_generator for the generator.
2024-02-15 03:45:01 +00:00
4d72fe8e43
fix: fixed issues with the maze generation
- 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.
2024-02-15 03:30:30 +00:00
d1c3ca6658
feat: add maze generation functionality
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.
2024-02-14 22:50:46 +00:00
6d919a99d6
fix: add errors for invalid cell creation
- 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.
2024-02-13 18:54:58 +00:00
536711f808
feat: add entrance, exit to the maze.
- 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.
2024-02-13 15:52:28 +00:00
2ebb555bac
fix: only draw the graphics if the window exists
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.
2024-02-13 13:39:25 +00:00
12b4e2367c
refactor: annotate method return type
Add missing annotations for methods that return None.
2024-02-13 10:59:47 +00:00
45a003270a
feat: add draw_move method to Cell
Add the draw_move method to the Cell class to draw a path between the
centre of two cells.
2024-02-13 10:48:26 +00:00
a19d9260d2
refactor: add a CellWall class
Add a CellWall class to simplify the code within the Cell class.
2024-02-13 01:15:19 +00:00
7d976f2350
feat: move Cell class to separate module. 2024-02-12 23:48:41 +00:00