- _TITLE "Word Search Puzzle Maker by rfrost@mail.com" 
-   
- ' schemes: 
- ' 0 fixed bonus for direction, each pass 
- ' 1 random bonus each pass 
- ' 2 random bonus each word 
-   
- start!  = TIMER- : bestblanks  = 9999- : crlf$  = CHR$(13) + CHR$(10)- : totalwords  = 103
- DIM-  word$ (- totalwords ),-  board (25, 25),-  pdir (8),-  hdir (8),-  vdir (8),-  worth (8),-  worda (- totalwords , 20),-  hc& (3,-  totalwords ),-  pf (13, 4),-  ord (- totalwords )
 
- FOR-  n  = 0 TO 9 '                                 tiny font
 
-         pf(n, i) = z * 4096 
-   
-     INPUT #1,-  bestwordsused ,-  bestblanks 
 
- FOR-  word  = 1 TO-  totalwords 
 
-     ord(word) = word 
-     word$ (- word ) = UCASE$(- word$ (- word ))
-     worda (- word , 0) = LEN(- word$ (- word ))
-     FOR-  j  = 1 TO-  worda (- word , 0)
 
-         worda (- word ,-  j ) = ASC(MID$(- word$ (- word ),-  j , 1))
-   
- begin: 
- try& = try& + 1 
-   
- FOR-  i  = 0 TO 9 '                                      scramble word pointers a bit each time
 
-     z1  = RND * (- totalwords  - 1) + 1
-     z2  = RND * (- totalwords  - 1) + 1
-   
- FOR-  i  = 1 TO 8 '                                      scheme 0
 
-     READ-  pdir (- i ),-  hdir (- i ),-  vdir (- i ),-  worth (- i )
 
-   
- wordsused = 0 
- FOR-  word  = 1 TO-  totalwords 
 
-     highscore = 0 
-     pt = ord(word) 
-     worda (- pt , 0) = ABS(- worda (- pt , 0))
-                 tscore = 0 
-                 FOR-  i  = 1 TO-  worda (- pt , 0)
 
-                     tr = row + vdir(dir) * (i - 1) 
-                     tc = col + hdir(dir) * (i - 1) 
-                     wv = worda(pt, i) 
-                     bv = board(tr, tc) 
-                         tscore = tscore - (tscore = 0) - (bv = wv) * 10 
-                     tscore = tscore + worth(dir) 
-                     tscore  =-  tscore  + RND * 2
-                 flag = (tscore > highscore) 
-                 IF-  tscore  =-  highscore  THEN-  flag  = -((RND * 100) > 96)
 
-                 IF-  flag  THEN-  highscore  =-  tscore: sdir  =-  dir: srow  =-  row: scol  =-  col 
 
-                 nextdir: 
-             nextcol: 
-         worda(pt, 0) = -worda(pt, 0) '                flag as not used 
-         COLOR-  pdir (- sdir ), 0 '                         show word
 
-         FOR-  i  = 1 TO-  worda (- pt , 0)
 
-             tr = srow + (i - 1) * vdir(sdir) 
-             tc = scol + (i - 1) * hdir(sdir) 
-             board(tr, tc) = worda(pt, i) 
-         wordsused = wordsused + 1 
-   
- hc&(scheme, wordsused) = hc&(scheme, wordsused) + 1 
-   
- numblanks = 0 
-         numblanks = numblanks - (board(row, col) = 0) 
-   
- IF (- wordsused  =-  bestwordsused ) AND (- numblanks  >=-  bestblanks ) THEN GOTO-  begin 
 
- bestblanks = numblanks: bestwordsused = wordsused 
-   
- PRINT #1,-  bestwordsused ,-  bestblanks 
 
-   
- PRINT #1,-  crlf$; crlf$; crlf$; crlf$; 
 
-         IF-  board (- row ,-  col ) = 0 THEN-  board (- row ,-  col ) = RND(1) * 25 + 65 ' random character (you might want chr$(219) or similar)
 
-         MID$(- OutLine$ , (- col  - 1) * 2 + 1, 1) = CHR$(- board (- row ,-  col ))
 
-     PRINT #1,-  OutLine$; crlf$; 
 
-     
- PRINT #1,-  crlf$;  "Blanks ="- ; numblanks; 
 
- t$  = "Words used:" + STR$(- wordsused )
- PRINT #1,-  crlf$; crlf$; t$; crlf$; crlf$; 
 
- CharsPrinted = 0 
- FOR-  word  = 1 TO-  totalwords 
 
-         t$ = word$(word) 
-             CharsPrinted = 0 
-         CharsPrinted  =-  CharsPrinted  + LEN(- t$ ) + 1
-   
- t$  = "Not used:" + STR$(- totalwords  --  wordsused )
- PRINT #1,-  crlf$; crlf$; t$; crlf$; crlf$; 
 
- CharsPrinted = 0 
- FOR-  word  = 1 TO-  totalwords 
 
-         t$ = word$(word) 
-             CharsPrinted = 0 
-         CharsPrinted  =-  CharsPrinted  + LEN(- t$ ) + 1
-   
-   
- scankey: 
-   
- stats: 
- et! = et! + el! 
- tet! = et! 
- u$ = "s" 
- IF-  tet!  > 60 THEN-  tet!  =-  tet!  / 60- : u$  = "m"
 
- IF-  tet!  > 60 THEN-  tet!  =-  tet!  / 60- : u$  = "h"
 
-   
- PRINT-  s$;  "Output:      ws.top"
 
-   
- y = 420: tc = 0 '                                     show count (with tiny font) for schemes 
-     IF (- hc& (0,-  i ) +-  hc& (1,-  i ) +-  hc& (2,-  i )) > 0 THEN
 
-             cc = j * 12 + 10 
-                 x = 20 + j * 4 
-                     LINE (- x ,-  y  +-  k )-(- x  + 4,-  y  +-  k ),-  tc , ,-  pf (- d ,-  k )
 
-         y = y - 8 
-   
-   
- tiny: 
-   
- words: