home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun: Game Pak
/
rerun-gamepak
/
findword
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
2KB
|
67 lines
10 rem jerry caron
12 rem berkley st.
14 rem berkley,ma.
20 rem initialize
30 print"[147] find a word"
40 print"are you using":print"a vic 20[146] or a 64[146]"
50 input"enter 20 or 64";ma:ifma<>20and ma<>64then50
55 ifma=20thenpoke36879,8
60 print"[147]setting up please wait..."
70 dime$(20,22),d$(20),zx(20),zy(20),qa(8),qb(8),tw(20)
80 fori=1to20:forj=1to20:e$(i,j)="":next:next
90 restore:fori=1to8:readqa(i),qb(i):next
100 data0,-1,1,-1,1,0,1,1,0,1,-1,1,-1,0,-1,-1
110 fori=1to20:d$(i)="":zx(i)=0:zy(i)=0:next
200 rem input words
210 print"[147]how many words(max 20)"
220 input nd$
230 print:nw=val(nd$):ifnw<1ornw>20then8010
240 print"[147] now type in the words"
250 print" they must be between 3 and 15 letters"
260 fori=1tonw
270 printi"[157]) ";
280 input"[157]";d$(i)
290 if len(d$(i))<3 or len(d$(i))>15 thenprintchr$(13)"[145][145][145]":goto270
300 print:next
310 open4,4
320 fori=1tonw
330 print#4,d$(i);spc(20-len(d$(i)));:ifi=4ori=8ori=12ori=16thenprint#4,:
340 next
350 print#4,:print#4,:forr=1to64:print#4,"*";:nextr:print#4,:print#4,"*";
360 print#4," ";spc(61);"*"
370 close4
400 rem place
410 print"[147] making grid "
420 print" please wait"
430 pw=0:forab=1tonw:pw=pw+1
440 zx(pw)=int(20*rnd(1)+1)
450 zy(pw)=int(20*rnd(1)+1)
460 dr=int(8*rnd(1)+1):tw(pw)=dr
470 cx=zx(pw)+len(d$(pw))*qa(dr):cy=zy(pw)+len(d$(pw))*qb(dr)
480 ifcx<1orcx>20orcy<1orcy>20then440
490 f=0:forck=0tolen(d$(pw))-1
500 z1$=mid$(d$(pw),ck+1,1):z2$=e$(zx(pw)+ck*qa(dr),zy(pw)+ck*qb(dr))
510 ifz2$<>""andz1$<>z2$thenf=1
520 next:iff=1then440
530 forck=0tolen( d$(pw))-1
540 z1$=mid$(d$(pw),ck+1,1):e$(zx(pw)+ck*qa(dr),zy(pw)+ck*qb(dr))=z1$
550 next
560 next ab
600 remprintsearchmatrix
610 print"[147]"
620 print"":fory=1to20:forx=1to20
630 ife$(x,y)=""thene$(x,y)=mid$(d$(nw*rnd(1)+1),3*rnd(1)+1,1)
640 ifma=64thenprinte$(x,y);" ";:goto660
650 ifma=20thenprinte$(x,y);
660 next
670 ifma=20thenprint
690 c=0:next
700 open4,4
710 fory=1to20:print#4,"* ";:forx=1to20
720 print#4,e$(x,y);" ";
730 next:print#4,"*":print#4,"*";spc(62);"*":next
740 forr=1to64:print#4,"*";:nextr:print#4,:print#4:close4
800 print"[147]program over"
810 input"y[146]es to run again ";s$
820 ifs$="y"thenclr:goto30