Commit graph

14 commits

Author SHA1 Message Date
2c76beb733
checkpoint: add ability to regenerate the maze
Some checks failed
test / test (pull_request) Failing after 1m0s
2024-02-18 05:48:07 +00:00
9bb23b6c6d
checkpoint: Graphics now draws paths
Move the path drawing functionality to the Graphics class. The Cell
class no longer needs to reference an instance of the Graphics class.
2024-02-18 02:21:09 +00:00
429990d12e
checkpoint: trying to move all drawing functions to Graphics 2024-02-17 21:25:03 +00:00
4c7e50ec39
checkpoint: Add side panel
Add a side panel to allow users to interact with the app.
The generate button now generates the maze.
2024-02-17 20:06:09 +00:00
a919c2698b
perf: reduce CPU usage whilst idle
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.
2024-02-15 01:40:16 +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
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
7d976f2350
feat: move Cell class to separate module. 2024-02-12 23:48:41 +00:00
14c6f659ff
feat: add the Cell class
Add the Cell class to represent a grid in the maze. Each 'Cell' can
be configured to specify which walls exists for it.
2024-02-12 23:32:03 +00:00
340eec773d
fix: position the window to the centre of screen 2024-02-12 21:30:27 +00:00
ccdffe00bf
fix: set missing attributes to the Canvas
Add missing attributes to the Canvas including it's size.
2024-02-12 20:04:55 +00:00
72dad848ec
feat: run a simple graphical window
Run a simple window and draw a few lines on it.
2024-02-12 19:53:45 +00:00