Skip to content

Update python_pathfinder.py - #3

Open
Zynx64 wants to merge 1 commit into
Karti07:mainfrom
Zynx64:patch-1
Open

Update python_pathfinder.py#3
Zynx64 wants to merge 1 commit into
Karti07:mainfrom
Zynx64:patch-1

Conversation

@Zynx64

@Zynx64 Zynx64 commented Jan 1, 2024

Copy link
Copy Markdown

I had to remove comments but i've reduced some code and made functions more direct so it loads faster.
Instead of using a nested loop to find the start and end points in the find_start_and_end function,
I just used enumerate to directly get the indices of the start and end points.
You can use a set to track visited cells instead of a 2D array.
Checking for membership in a set is faster than accessing a 2D array.
Checking memory in python - it quickly fill memory usage when larger mazes are used on low RAM devices (2< GB)
So that concludes why the above changes were made (mainly for efficiency and code compilation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant