Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Wordsearch Generator

Engaged ,
Feb 11, 2009 Feb 11, 2009
Hi,

Just for fun (yeah I'm that bored) I thought I'd try and come up with a word search generator. And the more I think about it, the more complicated the idea gets - I initially thought it would be very simple.

I am just wondering if you guys had any idea on the best approach to make on a project like this?

I think the way it would work from a user perspective, is that they put the words into a form and CF generates a grid with the words placed in automatically...but placing thw words will be the biggest issue...some may overlap...and if they do, I need to make sure that the letters are the same and in the correct position.

I initially thought that I could break the strings apart to there seperate letters then insert them at a random point into an array (but only if that slot is empty first)...but the part it goes into and all subsequent spaces for the loength of the words also need to be blank.

After words were in it would be a simple case of looping the array out and filling any empty spaces with randomly generated letters which would be easy enough.

Hmmm, what do you thinkt he best approach would be? Have any ideas?

I thought it would make a good CF exercise for myself.

Also note that the word search doesn't need to be interactive...it just needs to display the generated output so that the user can then print it.

Cheers,
Mikey.
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 11, 2009 Feb 11, 2009
If I were in your shoes, I would grab a piece of paper and a pencil, and literally draw a crossword puzzle from scratch. The computer is going to have to go through the same thought process that you are, so the resultant flow chart will dictate your journey.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 11, 2009 Feb 11, 2009
It's so difficult, because the data is output sequentially, in a loop, one by one. So, in effect...horizontal lines are fairly easy to do...but vertical lines are not. This is because the vertical lines would have to be at specifically separated indexes in the array. Horizontal lines would simply take indexes 1,2,3,4,5,6,7 etc for example. But a vertical could be 15,30,45,60.

And that's just vertical...what about diagonal? Then it gets really hairy. Not just that, but all the while I need to be making sure that the words do not overlap one another...or if they do, that there is enough space and that the over-lapping characters match.

Hmmmmmmm, this is an interesting challenge!

Any further help would be great.

Many thanks,
Michael.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 12, 2009 Feb 12, 2009
Sorry. For some reason I was imagining a crossword puzzle, rather than a word search. When you started talking about diagonals it really got me confused!

If I were in your shoes I would likely pass on this project. Not because it would not be challenging and teach you a thing or three, but rather because the potential that this challenge would come up again in your line of work is likely low. In other words, fun, yes. Useful, maybe not so much for a CF programmer.



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 12, 2009 Feb 12, 2009
LATEST
Well, as it happens, I don't even use CF for a living. It's just a language I use to get small sites up and play around with. I like it, it's fun and for the most part easy. But yeah, while I probably wont ever use this in my entire life, I don't wanna die not knowing how to accomplish this. I want to be better at what I do. And while I may not see any benefits just yet, it may reap benefits later on for more abstract things.

I am thinking it might be better to use a 2 dimensional array to create a kind of grid that can be referenced 1,1 1,2 1,3 2,1 2,2 2,3 etc etc. I'm not sure how this would help, but might give me more control over the grid instead of working with something strictly linear.

Anyone got any ideas?

Thanks.
Mikey.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources