Commodore 64 User Manual page 156

Hide thumbs Also See for 64:
Table of Contents

Advertisement

1 rein
seouence
2 rein
3 rent' e** from pet user group
4 rem *** software exchange
5 rem
***.
po box 371
6 rem e*m montgomeryville ,
pa 18936
7
rem
50 dim a$(26)
100 z$="at,cdefohijklmnopgrstuvwxuz"
110 z1$="12345678901234567890123456"
200 print" enter length of string to be sequence,10"
220 input "m8x i inum lengthy is 26 "; s%
230 if s%,:1 or s7.:26 then 200
240 s=s7
300 for i=1 to s
310 a$(i)=mid$(z$,i,l
320 next i
400 rem randomize strin0
420 for i=1 to s
430 k=int(rnd(1)*s+1)
440 t$=a$(i)
450 a$(i)=a$(k)
460 a$(k)=t$
470 next i
480 oosub 950
595 t=0
600 rem reverse substrino
605 t=t+1
610 input. "how many to reverse ";rX
620 if rZ=0 goto 900
630 if rY-O and rZ(::=s ooto 650
640 print "must be between 1 and ";s: goto 610
650 r=int(rX/2)
660 for i=1 to r
670 t$=a$(i)
680 a$(i)=a$(r%-i+1)
690 a$(r%-i+1)=t.$
700 next i
750 oosub 950
800 c=1: for i=2 to s
810 if a$(i):>a$(i-1) goto 830
820 c=0
830 next i
840 if c=0 aoto 600
850 print "puou did it in :t;" tries"
900 rem check for another game
910 input "Owant to play again ";y$
920 if left$(ya$,1)="u" or u$="ok" or 1a$="1" aoto 200
930 end
950 print
960 print left$(z1$,s)
970 for i=1 to s: print a$(i);:ne>:t i
980 print "0"
990 return
This program courtesy of Gene Deals
a
146

Hide quick links:

Advertisement

Table of Contents
loading

Related Products for Commodore 64

Table of Contents