home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 62 / af062sub.adf / WordSearch / WordSearch.DOC < prev    next >
Text File  |  1994-06-09  |  6KB  |  166 lines

  1. Wordsearch Generator
  2.  
  3. This is an automated wordsearch generator which supports puzzle sizes
  4. limitted (by defines) to 1000X1000 and up to 50 words.
  5. Words orientations can be limitted to any subset of the eight primary
  6. directions and the puzzle can be rotated or flipped. 
  7. It has a spartan but functional user interface highlighted by the 
  8. req.library and can output the word list, key and puzzle to file or prt:.
  9. The system default font under WB 2.0 is supported for the puzzle window.
  10.  
  11.  
  12. If you've ever tried to create a simple wordsearch you know the hardest
  13. part is getting past staring at a blank page.  So I wrote this program
  14. to randomly place words within a puzzle.
  15. It works by generating a first placement and then sequentially moving
  16. through the puzzle until the word fits.  Once a fit is found it goes
  17. to the next word.  If a fit cannot be made the previous word is attempted
  18. to be refitted and if it cannot then it steps back to the word before it.
  19. Therefore a complex puzzles may seem to take forever but given 
  20. enough time it will always determine if the words can be fit.
  21. Because forever is a long time I've added a requestor to abort the algorithm.
  22.  
  23.  
  24. Things to consider when running the program:
  25.  
  26. -Boost the stack: 4000 won't cut it for even very simple puzzles.
  27.  If the stack isn't large enough the program shouldn't crash but
  28.  it will shut down leaving the windows to clutter your workbench.
  29.  ei Stack 20000
  30.  
  31. -Use FastFonts (FF on Wb1.3) or the text scrolling with be abominal.
  32.  
  33. -If you have 2.0 try changing the system default text to something larger.
  34.  This will effect the Puzzle display window so you can make the puzzle large
  35.  enough to fill the WB screen and then use GraphicDump to print the puzzle.
  36.  
  37.  
  38. Hopefully the product IS intuitive so I'll just explain the general
  39. operation and the menus.  The speed of the interface also need
  40. improvement but for now its useable.
  41.  
  42. The Wordlist Window:
  43.  
  44. Here you enter your words.
  45. Click in the window and you'll see a cursor appear so you can enter a 
  46. word.
  47. Hitting return will push you down to the next line for entering another word.
  48. Note: this occurs even if the next word is below the bounds of the window
  49.  
  50. The scroll bar at the side of the window lets you change the view of the
  51. word list.
  52.  
  53. If you need to edit an entry just click where you want to change and use
  54. the delete or backspace or anything else available with Intuition string
  55. gadgets.
  56. There is also a menu for some more sophisticated editing of the wordlist
  57. which will be discussed later.
  58.  
  59.  
  60. The Puzzle Window:
  61.  
  62. Here the last generated key or puzzle is displayed.
  63. If the puzzle is larger than the window the scroll bars at the bottom and
  64. right side can be used to scroll about.
  65. What is displayed is controlled by a menu which will be discussed later.
  66.  
  67.  
  68. (Is it later already?)
  69. The Menus:
  70.  
  71. Project - controls printing and saving/loading a puzzle and wordlist
  72.  
  73.     New  -    clear the wordlist
  74.  
  75.     Open -    load a saved file
  76.           with call up a file requestor
  77.     Save -    save under the current file name
  78.           if a file name has not been set the requestor will come up
  79.     Save As - bring up requestor to change save filename and save the file
  80.     
  81.     Print
  82.         Wordlist - prints the wordlist as it appears in wordlist window
  83.                default output is to PRT:  See Print Redirect
  84.         Display  - prints the display as it appears in the puzzle window
  85.                default output is to PRT:  See Print Redirect
  86.     Print Redirect
  87.         To File - if active, will bring up requestor for where
  88.               to print the output when a print options is selected
  89.         To Clipboard - not implemented (yet)
  90.         
  91. Puzzle - controls generation of new puzzle information
  92.     Dimensions - set the dimensions of the puzzle via requestors
  93.              a new key and puzzle will be generated automatically
  94.     Generate    
  95.         New Key -        recreate the puzzle from the ground up
  96.         
  97.         New Puzzle -     only replace the filler the goes around words
  98.         
  99.         Try to Overlap - if active New Key will try to position words
  100.                  so the first attempt is to overlap the words
  101.     Word Direction - How words can be positions in the puzzle
  102.         Left -     only left to right
  103.         Left Down  etc
  104.         Down
  105.         Right Down
  106.         Right Up
  107.         Up
  108.         Left Up
  109.         
  110. Display - controls how the puzzle is displayed
  111.     Key -       display the key, only the letters placed from the wordlist
  112.                 are displayed
  113.     Puzzle -    display the key plus filler to hide the words
  114.     Direction - the puzzle/key can be fliped and rotated 90 degrees
  115.             the signs indicate if the puzzle is flipped along that axis
  116.             and the order indicates the horizontal and vertical axis of
  117.             the display
  118.         +X+Y - display as generated
  119.         +X-Y 
  120.         -X+Y - reverse the direction of the x axis
  121.         -X-Y
  122.         +Y+X - width along the vertical and height along horizontal
  123.         +Y-X
  124.         -Y+X
  125.         -Y-X
  126.  
  127. Wordlist - some manipulation commands for the word list
  128.            acts on the word were the cursor is active before selecting the menu
  129.     To Buffer -     copy the word to temporary storage
  130.             there is only one word stored in the temporary storage
  131.     From Buffer -     copy to the word from the buffer to the active word
  132.     
  133.     Insert -     make room for a word at the current location
  134.  
  135.     Delete -     delete the current word moving all subsequent words up
  136.     
  137.     Clean Up -     remove any blank words
  138.     
  139.     Uppercase All - convert all words to uppercase
  140.             puzzle is not affected so use this before you New Key
  141.     Sort -         sort words alphabetically
  142.  
  143.  
  144. Well that's it accept for the genaric disclaimer that I'm not responsible for
  145. anything which results from you running this program, good or bad.
  146.  
  147. The program IS public domain since I feel it can be seriously improved
  148. speed wise and I probably will not get around to working on it for a while.
  149.  
  150. As such I've included the source.
  151. I've also included the source for reqglue.o from the ReqLib package which has
  152. one function added so the default font height and width can be be retrieved
  153. easily in a C program.  To recompile you'll also need the programmer kit for
  154. the req.library available on fish.
  155. Compiled under Lattice 5.04.
  156.  
  157.  
  158. Tthanks to Anders Bjerin for putting together the C Manual on Fish 
  159. which gave me the courage to attempt the intuition interface, Colin Fox and 
  160. Bruce Dawson for my favorite requestor library, and to any and all in the
  161. AMiga Users of Calgary who I've annoyed with programming questions 
  162. particularly resident guru Stephen Vermeulen.
  163.  
  164. Craig Lever
  165.  
  166.