Commit graph

9 commits

Author SHA1 Message Date
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
30792f25b0
feat: add the Maze class
The Maze class stored a 2-dimensional grid of Cells. When the Maze is
initialised, the Cell's are created and drawn onto the canvas.
2024-02-13 12:18: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
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
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