AndrewRigg / Crossword

Crossword Generator made by Steven Court
0 stars 0 forks source link

Wordsearch: Click and Dragging for Diagonal words #99

Closed AndrewRigg closed 7 years ago

AndrewRigg commented 7 years ago

The Click and drag method works fine for horizontal, vertical and snaking words, but does not work for diagonal words as the user would have to move the cursor perfectly over the diagonal of each box to only hover over the correct one.

A different approach to selecting words is required for diagonals, for example allowing squares on either side of a diagonal (at one side and above or below) to be touched as well as the diagonal for the central letters but only the end points to be touched. And checking that each letter in the word has actually been touched in order in the selected letters.

Golpette commented 7 years ago

This one's interesting - I'll think about this as well as the hard sudoku methods.

Golpette commented 7 years ago

It's not perfect (you can cheat the system if you know how) but it's good enough for now.

Diagonal method just checks that (1) the first and last letter are the correct letters (but does NOT check they are at the correct x,y coords since we want to allow possible multiple occurrences of a word anyway) and (2) that what we dragged contains all the letters of the word.

I think the only improvement I could (should) easily make is that when checking that the string we have clicked and dragged contains all the letters of a word, I could make sure that if the actual word contains the same letter multiple times, so does the thing we dragged.

There might be a better way to do this though, so let me know if you ever think of one. Like I said, I think this is fine for now