Skip to content

[3] Generator: Initial Path#7

Merged
Thenlie merged 12 commits intomainfrom
3-generator/path
Jul 30, 2022
Merged

[3] Generator: Initial Path#7
Thenlie merged 12 commits intomainfrom
3-generator/path

Conversation

@Thenlie
Copy link
Copy Markdown
Owner

@Thenlie Thenlie commented Jul 30, 2022

Generate random path from start to finish ✅

A pseudo-random path is generated when the "Generate Maze" button is clicked. This renders the completed path to the front end. The code ensures that the path makes it to the finish cell. It also ensures that each yellow cell is touching exactly two other yellow cells, or the S or F cells.

I have tested maze sizes 10x10 up to 20x20 without issues. In all situations this code runs in less than one second.

NOTE: If the code fails to generate a valid path, it simply tries again. This means there could be some edge cases that take a lot of attempts to become valid. This may need to be edited in the future, or may require the maze to not increase significantly. Please open an issue if you notice this taking too long.

Closes #3

Screenshot

image

@Thenlie Thenlie added type: enhancement Additions to existing code priority: medium labels Jul 30, 2022
@Thenlie Thenlie added this to the Maze Generation Component milestone Jul 30, 2022
@Thenlie Thenlie requested review from maxh1231 and phillpeters July 30, 2022 16:04
@Thenlie Thenlie self-assigned this Jul 30, 2022
@Thenlie Thenlie linked an issue Jul 30, 2022 that may be closed by this pull request
4 tasks
@Thenlie Thenlie merged commit 6dcb811 into main Jul 30, 2022
@Thenlie Thenlie deleted the 3-generator/path branch July 30, 2022 16:07
@Thenlie Thenlie changed the title 3 generator/path [3[ Generator: Initial Path Jul 31, 2022
@Thenlie Thenlie changed the title [3[ Generator: Initial Path [3] Generator: Initial Path Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement Additions to existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create path from start to finish

2 participants