home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1991 August / 1991-08.d64 / riddle (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  8KB  |  267 lines

  1. 1 rem copyright 1991 - compute publications intl ltd - all rights reserved
  2. 10 dima$(99),g$(99),q(99),c(99),n(99),o(99),d$(99),ds(99),q$(99)
  3. 20 gosub 1940:gosub2560
  4. 30 pa$="":zr$="":print"[147]"chr$(158);:poke53272,23:printchr$(8)
  5. 40 gosub1960
  6. 50 getp$:ifp$=""then50
  7. 60 h=val(p$):if h<1 or h>9 then 50
  8. 70 on h goto 1420,110,110,1250,700,2160,2170,1540,1830
  9. 80 goto20
  10. 90 goto2130
  11. 100 if p$="y"then30
  12. 110 gosub1560:ifrq$<>""thenprint"[195][213][210][210][197][206][212][160][209][213][197][211][212][201][207][206]":print""rq$"[146]"
  13. 120 print"[197][206][212][197][210][160][210][201][196][196][204][197][160][209][213][197][211][212][201][207][206]":gosub1650
  14. 130 ifip$<>""andp$<>"_"thenrq$=ip$
  15. 140 if p$="_"then30
  16. 150 if rq$=""then110
  17. 160 gosub1560:print"[195][213][210][210][197][206][212][160][209][213][197][211][212][201][207][206]":print""rq$"[146]":print
  18. 170 if ra$<>""thenprint"[195][213][210][210][197][206][212][160][193][206][211][215][197][210]":print""ra$"[146]"
  19. 180 print"[197][206][212][197][210][160][210][201][196][196][204][197][160][193][206][211][215][197][210]":gosub1650
  20. 190 if ip$<>"" and p$<>"_" then ra$=ip$:lr=len(ra$)
  21. 200 if p$="_" then 110
  22. 210 if ra$="" then 160
  23. 220 fori=1tolr:ifasc(mid$(ra$,i,1))=32thenprint"[206][207][160][211][208][193][195][197][211]"
  24. 230 ifasc(mid$(ra$,i,1))=32thenprint:goto180
  25. 240 a=asc(mid$(ra$,i,1))
  26. 250 ifa>90 or a<64 thenprint"[204][207][215][197][210][195][193][211][197][160][204][197][212][212][197][210][211][160][207][206][204][217]":print:goto180
  27. 260 nexti
  28. 270 gosub1560:ifi$<>""thenprint"[195][213][210][210][197][206][212][160][201][206][211][212][210][213][195][212][201][207][206][211]":print""i$"[146]":print
  29. 280 print"[197][206][212][197][210][160][201][206][211][212][210][213][195][212][201][207][206][211]":gosub1650
  30. 290 ifip$<>"" and p$<>"_" then i$=ip$
  31. 300 if p$="_" then 160
  32. 310 if i$="" then 270
  33. 320 lr = len(ra$)
  34. 330 gosub1560:printlr;" [196][201][211][212][210][193][195][212][207][210][211]":print
  35. 340 if n<>0 then print"[195][213][210][210][197][206][212][160][206][213][205][194][197][210][160][207][198][160][208][210][207][194][204][197][205][211]":print""n"[146]":print
  36. 350 print"[197][206][212][197][210][160][206][213][205][194][197][210][160][207][198][160][208][210][207][194][204][197][205][211] ":gosub1650
  37. 360 if ip$<>""andp$<>"_"thenn=val(ip$)
  38. 370 if p$="_"then 270
  39. 380 if n = 0 then 330
  40. 390 i=1
  41. 400 gosub1560:printn;" [209][213][197][211][212][201][207][206][211]":print
  42. 410 if q$(i)<>""thenprint"[195][213][210][210][197][206][212][160][209][213][197][211][212][201][207][206]"i:print""q$(i)"[146]":print
  43. 420 print"[197][206][212][197][210][160][209][213][197][211][212][201][207][206] ";i:gosub1650
  44. 430 ifip$<>""andp$<>"_"thenq$(i)=ip$
  45. 440 if len(q$(i))>70 thenprint"[206][207][160][205][207][210][197][160][212][200][193][206] 70[160][195][200][193][210][193][195][212][197][210][211]"
  46. 450 if len(q$(i))>70 thenprint:goto420
  47. 460 if p$="_"then if i=1 then 330
  48. 470 if p$="_"then if i>1 then i=i-1:goto400
  49. 480 if a$(i)<>""thenprint"[195][213][210][210][197][206][212][160][210][201][199][200][212][160][193][206][211][215][197][210]":print""a$(i)"[146]"
  50. 490 print:print"[197][206][212][197][210][160][210][201][199][200][212][160][193][206][211][215][197][210]":gosub1650
  51. 500 ifip$<>""andp$<>"_"then a$(i)=ip$
  52. 510 if p$="_" then 400
  53. 520 if a$(i)=""then480
  54. 530 if len(a$(i))>70 then print:print"[206][207][160][205][207][210][197][160][212][200][193][206] 70 [195][200][193][210][193][195][212][197][210][211]"
  55. 540 if len(a$(i))>70 then print:goto420
  56. 550 i=i+1:if i<=n then 400
  57. 560 i=1
  58. 570 gosub1560:printlen(ra$);" [196][201][211][212][210][193][195][212][207][210][211]":print
  59. 580 ifd$(i)<>""thenprint"[195][213][210][210][197][206][212][160][196][201][211][212][210][193][195][212][207][210]";i:print""d$(i)"[146]":print
  60. 590 print"[197][206][212][197][210] [196][201][211][212][210][193][195][212][207][210]";i:gosub1650
  61. 600 ifip$<>""andp$<>"_"thend$(i)=ip$
  62. 610 if len(d$(i))>70 then print"[206][207][160][205][207][210][197][160][212][200][193][206][160]70[160][195][200][193][210][193][195][212][197][210][211]":print:goto590
  63. 620 if p$="_" then i=i-1:ifi>0 then goto570
  64. 630 ifi<=0 then i=n:goto400
  65. 640 if d$(i)=""then570
  66. 650 forj=1ton:a=val(a$(j)):ifd$(i)=a$(j) then670
  67. 660 nextj:goto680
  68. 670 print"[196][213][208][204][201][195][193][212][197][211] [193][206][160][193][206][211][215][197][210]":print:goto590
  69. 680 i=i+1:ifi<=len(ra$) then 570
  70. 690 goto30
  71. 700 gosub1580:input"[200][201][212][160][210][197][212][213][210][206][160][215][200][197][206][160][208][210][201][206][212][197][210][160][201][211][160][210][197][193][196][217]";zr$
  72. 705 ifzr$="_"orra$=""then30
  73. 710 gosub 1580
  74. 720 input"[206][213][205][194][197][210][160][207][198][160][195][207][208][201][197][211]";n$:nc=val(n$):ifn$="" or n$="_" then 30
  75. 730 open1,4,7:forpg=1tonc
  76. 740 forrs=139to143:pokers,asc(ra$):nextrs:gosub1390
  77. 750 x=0:fori=1ton:ifx<len(q$(i))thenx=len(q$(i))
  78. 760 nexti
  79. 770 it=x+9:cn=int(80/it):qc=cn
  80. 780 lq=0:zs=1:ze=76:ll=len(rq$):ifze>=llthenze=ll:goto820
  81. 790 ifmid$(rq$,ze,1)<>" "andze<>1thenze=ze-1:goto790
  82. 800 print#1,mid$(rq$,zs,ze-zs+1):zs=ze+1:ze=ze+76:lq=lq+1
  83. 805 ifze>=llthenze=ll:goto 820
  84. 810 goto790
  85. 820 n5=12+lq+li
  86. 830 print#1,right$(rq$,ll-zs+1):print#1:lq=lq+1
  87. 840 zs=1:ze=76:li=0:ll=len(i$):ifze>=llthenze=11:goto880
  88. 850 ifmid$(i$,ze,1)<>" "andze<>1thenze=ze-1:goto850
  89. 860 print#1,mid$(i$,zs,ze-zs+1):zs=ze+1:ze=ze+76
  90. 865 ifze>=llthenze=ll:li=li+1:goto880
  91. 870 goto850
  92. 880 print#1,right$(i$,ll-zs+1):li=li+1
  93. 890 t=cn:print#1:print#1:fori=1ton
  94. 900 print#1,str$(i);". ";q$(i);spc(it-len(q$(i))-len(str$(i))-2);
  95. 910 t=t-1:ift<=0thent=cn:print#1:print#1:n5=n5+2:gosub2130
  96. 920 nexti:print#1
  97. 930 fori=1ton
  98. 940 j=int(1+n*rnd(1)):ifc(j)=1then940
  99. 950 c(j)=1:o(i)=j:nexti:fori=1ton:c(i)=0:nexti
  100. 960 x=0:fori=1ton:ifx<len(a$(i))thenx=len(a$(i))
  101. 970 nexti
  102. 980 nd=len(ra$):fori=1tond
  103. 990 fori=1tond:ifx<len(d$(i))thenx=len(d$(i))
  104. 1000 :nexti:it=x+6:cn=int(80/it):fori=1tond
  105. 1010 j=int(1+nd*rnd(1)):ifc(j)=1then1010
  106. 1020 ds(i)=j:c(j)=1:nexti:fori=1tond:c(i)=0:nexti
  107. 1030 fori=1tolen(ra$):ifx<len(d$(i))thenx=len(d$(i)):nexti
  108. 1040 ifpa$="a"thenprint#1:print#1,ra$:print#1:i=1:j=1:t=cn
  109. 1050 ifpa$<>"a"thenprint#1:print#1:print#1:i=1:j=1:t=cn
  110. 1060 fq=len(ra$)/(n+len(ra$))
  111. 1070 k=rnd(1)
  112. 1080 ifk>fq thenm=int(1+26*rnd(1))
  113. 1090 lo=len(str$(o(i)))-3:ro=lo+2:z=o(i):z$=right$(str$(z),ro)
  114. 1095 ifpa$<>"a"then1130
  115. 1100 ifk>fq andi<=n and pa$="a" thenprint#1,z$;chr$(64+m);"=";a$(z);
  116. 1110 ifk>fq andi<=n thenprint#1,spc(it-(len(chr$(64+m))+3+len(a$(o(i))))-lo);
  117. 1120 ifk>fq andi<=n and pa$="a" then goto 1150
  118. 1130 ifk>fq andi<=n thenprint#1,chr$(64+m);" = ";a$(o(i));
  119. 1140 ifk>fq andi<=n thenprint#1,spc(it-(len(chr$(64+m))+3+len(a$(o(i)))));
  120. 1150 ifk>fq andi<=n theni=i+1:t=t-1
  121. 1160 ift<=0thent=cn:print#1:print#1:n5=n5+2:gosub2130
  122. 1170 if k>fq then1220
  123. 1180 ifj<=len(ra$)thenprint#1,mid$(ra$,j,1);" = ";d$(ds(j));
  124. 1190 ifj<=len(ra$)thenprint#1,spc(it-4-len(d$(ds(j))));
  125. 1200 c=0
  126. 1210 ifj>len(ra$)then1220
  127. 1215 j=j+1:t=t-1:ift<=0 thent=cn:print#1:print#1:n5=n5+2:gosub90
  128. 1220 ifi>n and j>len(ra$)then gosub1600
  129. 1230 ifi>n and j>len(ra$)then nextpg:close1:goto30
  130. 1240 goto1070
  131. 1250 gosub1580:n$="":input"filename";n$:ifn$="_" or n$="" or ra$="" then 30
  132. 1260 n$=n$+",s,w":open5,8,5,n$:nd=len(ra$)
  133. 1270 open15,8,15:input#15,e,e$,c,d
  134. 1280 if e<>63 then goto1310
  135. 1290 printe$;",ok to overwrite (y/n)";:inputyn$
  136. 1300 if left$(yn$,1)<>"y" then close5:close15:goto30
  137. 1310 close5:print#15,"s0:"+n$:close15:open5,8,5,n$
  138. 1320 print#5,rq$:print#5,ra$:print#5,n:fori=1ton:print#5,q$(i):nexti
  139. 1330 fori=1ton:print#5,a$(i):nexti
  140. 1340 fori=1tond:print#5,d$(i):nexti:print#5,i$:printchr$(147);
  141. 1350 close5:i=n+1:j=len(ra$)+1:c=0:goto30
  142. 1360 ifc=3 thenrun
  143. 1370 ifc=4 thenclose1:printchr$(147);:end
  144. 1380 goto1070
  145. 1390 print#1,"[195]ross out the letters that go with the right answers."
  146. 1400 print#1,"[212]he letters left will spell the answer to the following."
  147. 1410 print#1:print#1:return
  148. 1420 gosub1580:n$="":input"[198]ilename";n$:ifn$="_"orn$=""then30
  149. 1430 n$="0:"+n$+",s,r":open5,8,5,n$
  150. 1440 open15,8,15:input#15,e,e$,c,d
  151. 1450 if e<>62 then goto1470
  152. 1460 printe$;",hit <[210][197][212][213][210][206]>";:inputyn$:close5:close1