home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1987 May
/
1987-05.d64
/
unscramble.64
(
.txt
)
< prev
Wrap
Commodore BASIC
|
2022-09-20
|
3KB
|
68 lines
10 poke53281,0:poke53280,6:co=54272:sc=1024:ndx=198:rem ndx=208 on the 128
20 pokeco+24,15:pokeco+5,17:pokeco+6,240:pokeco,100
30 x=rnd(-ti):dima$(40),b$(40),te(40)
40 for i=0 to 9:read nu$(i):next:data 00,01,02,03,04,05,06,07,08,09
50 for i=1 to 5:read ff$(i):next:data first,second,third,fourth,fifth
60 print"[147][158]":d$=" "
70 printspc(14)"[155]unscramble":printspc(14)"[163][163][163][163][163][163][163][163][163][163]"
80 for i=0 to 1:print spc(11)"[154]player #"right$(nu$(i+1),1)"'s name"
90 printspc(11);:input p$(i):if p$(i)="" then print"[145][145]":goto90
100 p$(i)=left$(p$(i),10):next
110 print"[147]":pokendx,0:for i=1 to 5:w$(i)="":next
120 print" [155]"p$(c)
130 for i=1 to 5
140 print" [158]enter "ff$(i)"[146] word to be scrambled[146]"
150 print" ";:inputw$(i):ifw$(i)=""thenprint"[145]";:goto150
160 w$(i)=left$(w$(i),15):forp=1tolen(w$(i))
170 ifmid$(w$(i),p,1)<"a"ormid$(w$(i),p,1)>"z"thenp=len(w$(i)):next:goto140
180 next:next:print"[155] scrambling the words..."
190 gosub210:gosub330:gosub580
200 for i=1 to 10:b$(i)="":next:goto110
210 for i=1 to 5:r$(i)="":next:for mt=1 to 5:ups=len(w$(mt))
220 for i=1 to ups:te(i)=1:next
230 for i=1 to ups
240 xx=int(ups*rnd(1))+1:if te(xx)=0 then240
250 b$(i)=mid$(w$(mt),xx,1):te(xx)=0:next:r$(mt)=""
260 for i=1 to ups:r$(mt)=r$(mt)+b$(i)
270 next:if r$(mt)=w$(mt) and len(w$(mt))>1 then220
280 next
290 print"[147][145] words are scrambled ":qq=-q+1:sp=len(p$(qq))+24:sp=sp/2
300 ps=19-sp:print spc(ps) p$(qq)", press any key to begin":gosub670
310 pokendx,0:waitndx,1:geta$
320 print"[147]":return
330 for mt=1 to 5:cs=-c+1:sp=int(len(p$(cs))/2)
340 ps=19-sp:print""spc(11)d$"":printspc(11)d$:printspc(11)d$
350 print""spc(ps)""p$(cs):sp=int(len(r$(mt))/2):ps=19-sp
360 print"[158]"spc(ps) r$(mt)
370 for j=1 to len(w$(mt)):a$(j)=mid$(w$(mt),j,1):next
380 z=sc+360+ps:cc=z+co:x=ps:for i=1 to len(w$(mt)):poke z,99:poke cc,1
390 get r$:tm=tm+.06:if int(tm)> 59 then mi=mi+1:tm=int(tm)-60
400 if mi>9 then tt$=str$(mi):mi$=right$(tt$,2):goto420
410 mi$=nu$(mi)
420 if tm>=10 then tt$=str$(int(tm)):tm$=right$(tt$,2):goto440
430 tm$=nu$(tm)
440 print""spc(17)"[158]word"mt
450 print"[155]"spc(17)mi$":"tm$:if r$="" then390
460 print""
470 if r$=a$(i) then print tab(x)a$(i);:pa=50:ups=50:gosub660:goto490:stop
480 tm=tm+10:pa=20:ups=120:gosub660:goto390
490 z=z+1:x=x+1:cc=cc+1:next:next mt:print:print"":q=-c+1
500 sp=len(p$(q))+19:sp=int(sp/2):ps=19-sp
510 print spc(ps)"[154]total time for "p$(q)"[146] was":sp=14:mi=val(mi$)
520 print spc(sp);:if mi>0 then print"[157][157][157][157][157]" mi"minute";
530 if mi>1 then print"s";
540 if mi>0 then print" and";
550 tm=val(tm$):print tm"second";:if tm>1 then print"s"
560 print""spc(17)" "
570 for i=1 to 3000:next:so(q)=mi*100+tm:so$(q)=mi$+":"+tm$:tm=0:mi=0:return
580 ifc<>1thenc=1:return
590 print"[147][155] final scores":print spc(14)"[163][163][163][163][163][163][163][163][163][163][163][163]"
600 printspc(11)p$(0)tab(23)so$(0):print""spc(11)p$(1)tab(23)so$(1)
610 print"":wn$=p$(0):if so(0)=so(1) then print spc(14)"it's a tie":goto640
620 if so(1)<so(0) then wn$=p$(1)
630 print" "wn$" is the winner"
640 print" press any key to play again"
650 waitndx,1:geta$:run
660 poke co+1,pa:poke co+4,33:for qq=1 to ups:next:poke co+4,32:return
670 for pa=40 to 20 step-1:ups=20:gosub660:next:for i=1 to 500:next:return