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

preferOverlap not working as expected. #6

Open
MrJoshFisher opened this issue May 13, 2016 · 3 comments
Open

preferOverlap not working as expected. #6

MrJoshFisher opened this issue May 13, 2016 · 3 comments

Comments

@MrJoshFisher
Copy link

Hello, I've set preferOverlap to false, within the wordfind.js file but its still overlapping when generating the wordsearch, am I missing something or am I suppose to put preferOverlap somewhere else?

@bunkat
Copy link
Owner

bunkat commented May 13, 2016

That setting will try to maximize the amount of overlap in the puzzle. There isn't currently a setting to eliminate overlap. Setting preferOverlap to false just means it will randomly select from all possible valid positions found. If you try and eliminate overlap the puzzle might take a long time to generate.

However, if that's what you want it wouldn't be too hard to do. Just look in the code where preferOverlap is used and select the position with zero overlap instead or fail the placement. The puzzle size will increase until a valid puzzle is found.

@bunkat
Copy link
Owner

bunkat commented May 13, 2016

Look at 'placeWordInPuzzle'. You'll want to filter the locations array to only pick ones where location.overlap === 0. Everything else should just work.

@MrJoshFisher
Copy link
Author

Ahhh shame my crossword has multiple words that tend to overlap e.g copywriting, copy, writing. Is there a way to change the opacity of a word that overlaps so you could se on the word search that the words overlap if that makes sense.

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

No branches or pull requests

2 participants