wordfind icon indicating copy to clipboard operation
wordfind copied to clipboard

preferOverlap not working as expected.

Open MrJoshFisher opened this issue 8 years ago • 3 comments

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?

MrJoshFisher avatar May 13 '16 14:05 MrJoshFisher

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 avatar May 13 '16 17:05 bunkat

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

bunkat avatar May 13 '16 18:05 bunkat

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.

MrJoshFisher avatar May 13 '16 20:05 MrJoshFisher