Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create random pattern generator #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pwjablonski
Copy link

Hi Keiran!

I came across your project when trying to make my own crossword builder. I love puzzles and seems like a really fun project to contribute to rather than starting from square one. I wanted to take a shot at this feature to get my feet wet. Not too confident my approach is the cleanest or most efficient, and I am very open to your suggestions.

Current State
Currently, when the user clicks on the generate pattern button the program selects a pattern from a predefined array of patterns.

Goal of this PR:
Create a random pattern generator that programmatically creates a unique board each time the user clicks the generate pattern button.

Approach
Given the conventional crossword rules, each word must be 3 letters long and the board should retain rotational symmetry. To do this, I Iooped through each square's location on the grid. I check the surrounding squares of each square looped through. If we are able to add the square based on the given rules, we randomly decide whether or not to add the square to the pattern.

Limitations

  • I would still need to make some changes to fully account for different board sizes
  • There is no way to pick a predefined pattern which might be frustrating

Excited to hear your thoughts and looking forward to contributing more in the future!

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