Dec 23 2007

perl: Word Search Generator

Published by at 11:26 am under Programming

Wrap Up

I know I copped out in certain ways in this program. The max_attempts is the biggest cop-out. We should be able to know exactly when it is futile to look for more ways to place a word and then stop. Or better yet, if the program reaches a dead end for a given word, it could remove some of the other words which would allow the new one to be placed. But hey, the program is able to place all the words most of the time, and if it doesn’t place them all, simply run it again and it may do better. That randomness with which the words are picked effects how many words it can place, if it is running out of space.

Obviously you can make the program fail by specifying a 8×8 grid, and then giving 10-letter words.

Once again here are the 2 files which you can download:

  • ws.pl – the perl source code (rename to ws.pl)
  • animals.txt – a sample configuration file

Coming up with the logic behind this project is the most satisfying part. And I find perl to be a great way to implement it!

Pages: 1 2 3 4 5 6 7

3 responses so far

Please do not load this page directly. Thanks!