Phil icon indicating copy to clipboard operation
Phil copied to clipboard

create random pattern generator

Open pwjablonski opened this issue 6 years ago • 0 comments

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!

pwjablonski avatar Jan 06 '19 03:01 pwjablonski