home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 33 / 033.d81 / conundrum (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  3KB  |  98 lines

  1. 100 poke53280,.:poke53281,.
  2. 180 print chr$(142)"[147]";tab(11);"[158]***  conundrum [146] ***"
  3. 190 print "";tab(19);"by"
  4. 200 print "";tab(12);"richard f. daley"
  5. 210 print tab(18);"and"
  6. 220 print tab(13);"sally j. daley"
  7. 230 gn$="     [146][157][157][157][157][157]     [146][157][157][157][157][157]    [157][157][157][157][157]     [146][157][157][157][157][157]     [146][145][145][145][145]"
  8. 240 rd$="     [146][157][157][157][157][157]     [146][157][157][157][157][157]    [157][157][157][157][157]     [146][157][157][157][157][157]     [146][145][145][145][145]"
  9. 250 rt$="": dn$=""
  10. 260 print "          press return[146] to begin"
  11. 270 get kb$: if kb$<>chr$(13) then 270
  12. 280 dim sq(9),rv(9)
  13. 290 print "[147]": poke 53280,0: poke 53281,0
  14. 300 gosub 920:  for ct=1 to 9: sq(ct)=0: if rnd(ti)>.65 then sq(ct)=1
  15. 310 next ct
  16. 320 rem
  17. 330 rem *** main loop ***
  18. 340 rem
  19. 350 gosub 1020: print
  20. 360 wn=0: gosub 580: if wn<>0 then 650
  21. 370 print "[159]which one to reverse?      [157][157][157][157][157]";: gosub 790
  22. 375 ifkb$="q"orkb$="[209]"then740
  23. 380 if val(kb$)<1 or val(kb$)>9 then print "[145][145]": goto 370
  24. 390 if sq(val(kb$))=1 then sq(val(kb$))=0: goto 410
  25. 400 sq(val(kb$))=1
  26. 410 on val(kb$) goto 430,440,450,460,470,480,490,500,510
  27. 420 goto 350
  28. 430 t=3: rv(1)=2: rv(2)=4: rv(3)=5: goto 520: rem square 1
  29. 440 t=2: rv(1)=1: rv(2)=3: goto 520: rem square 2
  30. 450 t=3: rv(1)=2: rv(2)=5: rv(3)=6: goto 520: rem square 3
  31. 460 t=2: rv(1)=1: rv(2)=7: goto 520: rem square 4
  32. 470 t=4: rv(1)=2: rv(2)=4: rv(3)=6: rv(4)=8: goto 520: rem square 5
  33. 480 t=2: rv(1)=3: rv(2)=9: goto 520: rem square 6
  34. 490 t=3: rv(1)=4: rv(2)=5: rv(3)=8: goto 520: rem square 7
  35. 500 t=2: rv(1)=7: rv(2)=9: goto 520: rem square 8
  36. 510 t=3: rv(1)=8: rv(2)=5: rv(3)=6: rem square 9
  37. 520 for ct=1 to t: if sq(rv(ct))=1 then sq(rv(ct))=0: goto 540
  38. 530 sq(rv(ct))=1
  39. 540 next ct: goto 350
  40. 550 rem
  41. 560 rem *** check for win ***
  42. 570 rem
  43. 580 for ct=1 to 9: if sq(ct)=1 then wn=wn+1
  44. 590 next ct: if wn=8 and sq(5)=0 then wn=1: return
  45. 600 if wn=0 then wn=-1: return
  46. 610 wn=0: return
  47. 620 rem
  48. 630 rem *** game over - display winner and exit ***
  49. 640 rem
  50. 650 j=0: if wn=-1 then 750
  51. 660 print "[153][147][205]  [206][157][157][157][205][206][157][157][157] [167] [157][157][157] [167] [145][145][145][206][163][205][157][157][157][165] [167] [157][157][157][157][165] [167] [157][157][157][157]";
  52. 670 print "[205][164][206][145][145][145][165] [167] [157][157][157][157][165] [167] [157][157][157][157][165] [167] [157][157][157][157][205][164][206][145][145][145]";
  53. 680 print "[165]  [167][157][157][157][157][165]  [167][157][157][157][157][165]  [167][157][157][157][157]";
  54. 690 print "[205][206][205][206][145][145][145][206][163][205][157][157][157][165] [167][157][157][157][165] [167][157][157][157][205][164][206][145][145][145][167][205]   [165][157][157][157][157][157][157]";
  55. 700 print "[167] [205]  [165][157][157][157][157][157][157][167]  [205] [165][157][157][157][157][157][157][167]   [205][165][145][145][145][221][157][221][157][221][157][215]"
  56. 710 print "";dn$;dn$;dn$;dn$;"do you wish to play again? ";
  57. 715 gosub790
  58. 720 if left$(kb$,1)="y" then 290
  59. 726 if left$(kb$,1)<>"n" then 715
  60. 730 print "[147][154]thanks for the game"
  61. 740 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
  62. 745 print"[147]";:ifer<>63thenend
  63. 746 load"hello connect",8
  64. 750 print "[156]";dn$;dn$;dn$;dn$;"how clumsy of you! you lose!": goto 710
  65. 760 rem
  66. 770 rem *** keyboard input subroutine ***
  67. 780 rem
  68. 790 print "[166][146][157]";
  69. 800 get kb$
  70. 810 if kb$<>"" then if asc(kb$)<>13 then print " ": return
  71. 820 for ct=1 to 40
  72. 830 get kb$
  73. 840 if kb$<>"" then if asc(kb$)<>13 then print " ": return
  74. 850 next ct: print "[166][157]";: for ct=1 to 40
  75. 860 get kb$
  76. 870 if kb$<>"" then if asc(kb$)<>13 then print " ": return
  77. 880 next ct: goto 790
  78. 890 rem
  79. 900 rem *** subroutine to print the grid on the screen ***
  80. 910 rem
  81. 920 print dn$;rt$;"[145][145][145][176][192][195][192][192][192][178][192][195][192][192][192][178][192][195][192][192][192][174]": gosub 980: for j=1 to 2
  82. 930 print rt$;"[171][192][195][192][192][192][219][192][195][192][192][192][219][192][195][192][192][192][179]": gosub 980
  83. 940 next:print rt$;"[173][192][195][192][192][192][177][195][192][192][192][192][177][192][195][192][192][192][189]"
  84. 942 print"            press 'q' to quit"
  85. 945 print "[158]"dn$rt$"";
  86. 950 for ct=1 to 9: print "";ct;"";
  87. 960 if ct/3=int(ct/3) and ct<>9 then print: print "";rt$;
  88. 970 next ct: return
  89. 980 for ct=1 to 5: print rt$;"[221]     [221]     [221]     [221]": next ct: return
  90. 990 rem
  91. 1000 rem *** subroutine to display current status of squares ***
  92. 1010 rem
  93. 1020 print "";dn$;rt$;"[145][145]";: for ct=1 to 9
  94. 1030 if sq(ct)=1 then print gn$;: goto 1050
  95. 1040 print rd$;
  96. 1050 if ct/3=int(ct/3) then print: print "";rt$;"";
  97. 1060 next ct: return
  98.