1

I need an script for generating crossword game. I have a list of 8 words for which I wnat to generate a crossword game, let's say for 15 column and 15 row.

I am not getting the concept of this problem. How to generate this using PHP ?? Can anyone tell me how to do that ??

djmzfKnm
  • 26,679
  • 70
  • 166
  • 227
  • 1
    Duplicate: http://stackoverflow.com/questions/943113/algorithm-to-generate-a-crossword – Greg Hewgill Jun 05 '09 at 09:39
  • Not exactly a duplicate. This one is speaking in terms of PHP and sounds like Prashant wants an actual crossword style not just word crossing. – JoshFinnie Jun 05 '09 at 18:52
  • @Josh - the other question asks about the general algorithm, which should be applicable to any language. Also, with only 8 words, a simple "word cross" is all that will be possible. – nickf Oct 12 '09 at 06:13
  • I would think the average crossword puzzle generator starts with a database of thousands of words/clues, and randomly produces a subset that happens to fit together. – Dolph Mar 15 '10 at 02:06
  • Does this answer your question? [Algorithm to generate a crossword](https://stackoverflow.com/questions/943113/algorithm-to-generate-a-crossword) – Nico Haase Oct 21 '20 at 11:48

2 Answers2

0

I think that sounds easier than it is in practice, certainly when you only start with a list of 15-20 words. It is very difficult this way to put those words into a crossword. In most cases it will even be impossible...

Fortega
  • 19,463
  • 14
  • 75
  • 113
  • Its not exact, I just added 15-20 for refrence... It can be less word. – djmzfKnm Jun 05 '09 at 09:43
  • 1
    I think Fortega meant that it's easier to start with a list of ALL words (hundredthousands), and then find a crossword solution from that, with 15-20 words in it. – 0scar Jun 05 '09 at 10:10
0

I think this is a fun idea and i will try that some time, should be possible. Of couse you never know if there is a posibility for the given words in the given size, but if you try tons of combinations with an algorithm i think that should get some "acceptable" results.

I'd just start with the first word put it on the map, and then you try all other words left in all positions. And so on. So you get really a damn lot of combinations, which you could delete if they break you wanted size, and in the end you might have a nice list of possibilites and show like the 10 smallest of that to choose from. My GF is away this weekend, maybe ill have a try. I think recursive could be the right way to do that.

  • Basically I am not getting the algorithm or you can say idea which is applicable for crosswords. In crossword, there are lot of combination's, you have to put each word in a way so that it will match with other. And also I have to show up an error if any word is different from all other. Like I have a list AUS, IND, WST, PAK, SLK and EFV. EFV is not matching with any other word. So in this case I have to show up an error for this word. Please tell me the concept or even just some code with which I can get started for this.... – djmzfKnm Jun 06 '09 at 09:57