8-Bit Software Online Conversion
Wordsearch Creator - Listing
10REM Tue,02 Jun 1992.09:39:50
20DEFFNS:$(PAGE+6)=TIME$:="WRDSRCH"
30ONERROR:VDU3:MODE128:REPORT:PRINTER
L:END
40MODE7:PROCt:K$="":E%=100:U%=0:Z$=""
50INPUT" How many words? 0 to load "Q
%
60IF Q%<>0 REPEAT:INPUT" Columns? "C%
:C%=C%+1:UNTILC%>0ANDC%<81:REPEATINPUT"
Rows? "R%:UNTILR%>0ANDR%<81:DIMA$(Q%),B$
(R%+1):PROCt:PROCgw
70IFQ%=0:OSCLI".":INPUT" Load name? "
Z$:F%=OPENINZ$:INPUT#F%,U%,E%,Q%,C%,R%,K
%,K$:DIMA$(Q%),B$(R%+1):PROCl
80W%=R%:REPEAT:P%=0:PROCt
90PRINTTAB(7)" Words:";Q%;" Unused:"
;U%TAB(7)" A - Alter word:"TAB(7)" B - B
uild grid."TAB(7)" D - Display grid."TAB
(7)" F - Fill spaces."TAB(7)" L - Load/R
estart."
100PRINTTAB(7)" O - Sort."TAB(7)" P -
Print."TAB(7)" Q - Spool"TAB(7)" R - Re-
define grid:]";C%-1;" ^";R%TAB(7)" S - S
ave."TAB(7)" T - Tries:";E%TAB(7)" U - U
nsort."TAB(7)" E - End."
110Q$=GET$:PROCt
120IFQ$="A"PROCat
130IFQ$="B"PROCmg:Q$="D":K$=""
140IFQ$="D":P%=3
150IFQ$="F"PRINT''" Filling spaces":PR
OCf
160IFQ$="R"PROCgs
170IFQ$="L"RUN
180IFQ$="O"PROCst
190IFQ$="P"P%=1
200IFQ$="Q"P%=2
210IFP%MODE128:PROCdg:MODE7
220IFQ$="S"PROCs
230IFQ$="T"INPUT" How many tries at ea
ch word? "E%
240IFQ$="U"PROCu
250IFQ$="E":END
260UNTILFALSE
270DEFPROCgs:REPEAT:INPUT" Columns:"C%
:C%=C%+1:UNTILC%>0ANDC%<81:REPEATINPUT"
Rows:"R%:UNTILR%>0ANDR%<=W%:ENDPROC
280DEFPROCgw:PRINTTAB(6,8)" Enter word
"
290FORL%=1TOQ%:PRINTTAB(18,8);L%;:INPU
TTAB(0,10)A$(L%):A$(L%)=A$(L%)+CHR$(0):P
RINTTAB(0,10)SPC80:NEXT:ENDPROC
300DEFPROCst:PRINT''TAB(7)" Sorting."
310FORL%=Q%TO1STEP-1:A$(0)=A$(L%):T%=0
:T$="":FORB%=L%TO0STEP-1:IFA$(B%)>T$:T$=
A$(B%):T%=B%
320NEXT:A$(L%)=A$(T%):A$(T%)=A$(0):NEX
T
330ENDPROC
340DEFPROCu:PRINT''TAB(7)" Unsorting.
":FORL%=1TOQ%:B%=RND(Q%):A%=RND(Q%):A$(0
)=A$(B%):A$(B%)=A$(A%):A$(A%)=A$(0):NEXT
:ENDPROC
350DEFPROCl:FORL%=0TOQ%:INPUT#F%,A$(L%
):NEXT:FORL%=1TOR%:INPUT#F%,B$(L%):NEXT:
CLOSE#F%:ENDPROC
360DEFPROCs:OSCLI".":INPUT" Save name?
"Q$:F%=OPENOUTQ$:PRINT#F%,U%,E%,Q%,C%,R
%,K%,K$:FORL%=0TOQ%:PRINT#F%,A$(L%):NEXT
:FORL%=1TOR%:PRINT#F%,LEFT$(B$(L%),C%+1)
:NEXT
370CLOSE#F%:ENDPROC
380DEFPROCt:CLS:PRINTTAB(5)"
ator"''TAB(7)" By C.J.Richardson"'':END
PROC
390DEFPROCdg:IFP%=1VDU2:ELSE IFP%=3VDU
14 ELSEIFP%=2INPUT"Name to spool? "Y$:OS
CLI"SPOOL "+Y$
400PRINTTAB(7)"Word search generator b
y C.J.Richardson. File ";Z$;" Difficulty
:";K%
410IFC%>40 FORL%=1TOR%:PRINTMID$(B$(L%
),1,C%+1):NEXT
420IFC%<41 FORL%=1TOR%:FORB%=2TOC%:PRI
NTMID$(B$(L%),B%,1)+" ";:NEXT:PRINT:NEXT
430PRINT:Z%=0:U%=Q%:FORL%=1TOQ%:IFP%=3
:PRINTTAB(Z%);L%;
440IFASC(RIGHT$(A$(L%),1))=1PRINTTAB(Z
%+3)LEFT$(A$(L%),LENA$(L%)-1);:Z%=Z%+20:
U%=U%-1:IFZ%=80Z%=0
450NEXT:OSCLI"SPOOL":IFP%=3PRINT'"Secr
et word:";K$
460VDU13,3:PROCun:VDU15:ENDPROC
470DEFPROCat:INPUT" Number of word to
alter? "L%:PRINTLEFT$(A$(L%),LENA$(L%)-1
):INPUT" New word? "A$(L%):A$(L%)=A$(L%)
+CHR$(0):ENDPROC
480DEFPROCmg:INPUT" Answer file? Name/
RETURN "Q$:IFQ$<>""F%=OPENOUTQ$
490PRINT" Hang on. Making grid.":FORL%
=1TOR%:B$(L%)=CHR$0+STRING$(C%," ")+CHR$
0:NEXT
500B$(0)=STRING$(C%+2,CHR$0):B$(R%+1)=
STRING$(C%+2,CHR$0)
510FORL%=1TOQ%:A$(L%)=LEFT$(A$(L%),LEN
A$(L%)-1)+CHR$(0):NEXT:K%=RND(8)
520FORL%=1TOQ%:D%=RND(5):IFD%=1:D%=K%
ELSE D%=RND(8)
530IFD%=1 H%=1
540IFD%=2 H%=-1
550IFD%=3 H%=C%
560IFD%=4 H%=-C%
570IFD%=5 H%=C%+1
580IFD%=6 H%=C%-1
590IFD%=7 H%=-(C%-1)
600IFD%=8 H%=-(C%+1)
610PRINTTAB(15,10);L%
620I%=0:REPEAT:PROCgets
630O%=S%:T%=1:REPEAT:X%=1+S%MODC%:Y%=S
%DIVC%:T$=MID$(B$(Y%),X%,1):IFT$=" "OR T
$=MID$(A$(L%),T%,1)T$=""
640IF ASC T$=0T$="N"
650T%=T%+1:S%=S%+H%:IFS%<0ORS%>(R%+1)*
C%T$="N"
660UNTILT$<>""ORT%=LEN(A$(L%))
670S%=O%
680IFT$=""FORB%=1TOLEN(A$(L%))-1:X%=1+
S%MODC%:Y%=S%DIVC%:B$(Y%)=LEFT$(B$(Y%),X
%-1)+MID$(A$(L%),B%,1)+MID$(B$(Y%),X%+1)
:S%=S%+H%:NEXT:I%=E%:A$(L%)=LEFT$(A$(L%)
,LENA$(L%)-1)+CHR$(1)
690I%=I%+1
700UNTILI%>E%:IFQ$<>"" BPUT#F%,1+O%MOD
C%:BPUT#F%,O%DIVC%
710NEXT:IFQ$<>""CLOSE#F%:PROCs
720ENDPROC
730DEFPROCun
740PRINT'"Unused:":FORL%=1TOQ%:IFASC(R
IGHT$(A$(L%),1))=0PRINTL%;" ";A$(L%):NEX
T ELSE NEXT
750PRINT''"Press a key":REPEATUNTILGET
760ENDPROC
770DEFPROCf:U%=0:FORL%=1TOR%:FORB%=1TO
C%:IFMID$(B$(L%),B%,1)=" "U%=U%+1:NEXT,
ELSE NEXT,
780PRINT" There are ";U%;" spaces."'"
Enter secret word/s":INPUTK$:IFK$=""K$="
D"
790Q$=K$:U%=1:FORL%=1TOR%:FORB%=1TOC%:
IFMID$(B$(L%),B%,1)=" "B$(L%)=LEFT$(B$(L
%),B%-1)+MID$(Q$,U%,1)+MID$(B$(L%),B%+1)
:U%=U%+1:IFU%>LENQ$U%=1:Q$=CHR$(RND(26)+
64)
800NEXT,:Q$="":ENDPROC
810DEFPROCgets:IFI%>-1IFI%<E%S%=RND((R
%+1)*(C%)):ENDPROC
820IFI%=E%:I%=-9999:S%=-1
830S%=S%+1:IFS%=(R%+1)*C%:I%=E%
840ENDPROC