MichaelWehar/Crossword-Layout-Generator

Words occasionally overlap

Opened this issue · 0 comments

Occasionally two words in the same direction overlap. For example:

{
clue: 'just born',      
      answer: 'baby',
      orientation: 'down',    
      startx: 16,
      starty: 15
}

{
      clue: 'feline',
      answer: 'cat',
      orientation: 'down',
      startx: 16,
      starty: 14,
}

For some reason with these specific words it happens nearly all of the time:
baby, cat, nicotine, chocolate
Baby and cat consistently overlap as do nicotine and chocolate.
For now I am doing manual checks to ensure this doesn't happen, but I'm stumped as to what's going on here.

I am currently generating the crosswords by selecting 5 random words from the following:
baby, cat, university, nicotine, chocolate, cactus, aquarium. The two aforementioned pairs consistently overlap when they are selected regardless of the other words.