home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1990 March & April / rerun-1990-03-04.d64 / alphabet (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  134 lines

  1. 100 rem alphabet shuffle
  2. 105 rem by charles phoenix (01/89)
  3. 110 rem
  4. 112 goto450:rem goto setup
  5. 114 rem
  6. 135 printleft$(dn$,23);:rem print prompt and wait for fire
  7. 140 print"     press fire button to continue."
  8. 145 if(peek(jy)and16)/16then145
  9. 150 return
  10. 155 rem
  11. 170 printleft$(dn$,vp+tx*4-4):rem print letter at (x,y)
  12. 175 ifa$=""ora$=" "thenpoke646,0:goto185
  13. 180 poke646,2+(asc(a$)-65)/gn
  14. 185 printspc(hp+ty*4-3);"   [157][157][157] ";right$(" "+a$,1);" [157][157][157]   [146]"
  15. 190 return
  16. 195 rem
  17. 210 m=0:ti$="000000":rem *** main loop
  18. 215 x=gn:y=gn
  19. 220 ox=x:oy=y
  20. 225 rem
  21. 230 print"[158]   moves = ";m
  22. 235 print"[158]time = ";mid$(ti$,3,2);":";right$(ti$,2)
  23. 240 rem
  24. 245 if(peek(jy)and16)/16=0then385
  25. 250 rem
  26. 255 jd=notpeek(jy)and15
  27. 260 ifjd=1orjd=2thenx=x-(jd=1)+(jd=2):ifx>0andx<=gnthen280
  28. 265 ifjd=4orjd=8theny=y-(jd=4)+(jd=8):ify>0andy<=gnthen280
  29. 270 x=ox:y=oy:goto230
  30. 275 rem
  31. 280 m=m+1:rem increase # of moves
  32. 285 rem
  33. 300 tx=x:ty=y:a$=" ":gosub170:rem swap new square with old square
  34. 305 tx=ox:ty=oy:a$=pg$(x,y):gosub170
  35. 310 pg$(ox,oy)=pg$(x,y):pg$(x,y)=" "
  36. 315 rem
  37. 330 c=gn*gn:rem check for winner
  38. 335 fori=1togn
  39. 340 : forj=1togn
  40. 345 :   ifpg$(i,j)=cg$(i,j)thenc=c-1
  41. 350 : next
  42. 355 next:ifcthen220
  43. 365 rem
  44. 380 print"[147]congratulations....you've done it":goto390:rem end prg
  45. 385 print"[147]giving up......tsk, tsk"
  46. 390 print"  the current game time is....: ";
  47. 395 print"[158]";mid$(ti$,3,2);":";right$(ti$,2)
  48. 400 print"  the current # of moves is...:[158]";m
  49. 405 rem
  50. 410 fori=1to500:next:rem small delay
  51. 415 gosub135:rem wait for fire button
  52. 420 goto480:rem goto setup
  53. 425 rem
  54. 445 rem
  55. 450 dim cg$(5,5),pg$(5,5):rem initialize
  56. 455 jy=56320:rem for joystick #1 change 56320 to 56321
  57. 460 dn$=""
  58. 465 rem
  59. 480 poke53280,0:poke53281,0:rem title screen
  60. 485 print"[147]          the alphabet shuffle"
  61. 490 print"[158]         [183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183]
  62. 495 [153]"  1) sysbeginner game........ 3 by 3 grid
  63. 500 print"  2) [158]intermediate game.... 4 by 4 grid
  64. 505 [153]"  3) sysexpert game.......... 5 by 5 grid
  65. 510 print" move joystick (up/down) to select game
  66. 515 [153]"       press fire button to enter
  67. 520 gn=3:gosub600:rem select game w/joystick
  68. 525 rem
  69. 540 if(peek(jy)and16)/16=0then650
  70. 545 jd=notpeek(jy)and15
  71. 550 ifjd<>1andjd<>2then540
  72. 555 gosub580:goto540
  73. 575 rem
  74. 580 print"[144]";:gosub610
  75. 585 gn=gn+(jd=1)-(jd=2)
  76. 590 ifgn<3thengn=5
  77. 595 ifgn>5thengn=3
  78. 600 print"[158]";
  79. 605 rem
  80. 610 printleft$(dn$,5+(gn-2)*3);
  81. 615 print" [213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]
  82. 620 [153]" (NULL)(NULL)
  83. 625 print" [202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]
  84. 630 [142]
  85. 635 [143]
  86. 650 [153]"load   instructions for alphabet shuffle":[143] instruction screen
  87. 655 [153]"sys  usrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusr
  88. 660 print"    the object of this game is quite
  89. 665 [153]"   simple. just rearrange the letters
  90. 670 print"        into [158]alphabetical order.
  91. 675 [153]"             tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(
  92. 680 print"    when the game is completed each
  93. 685 [153]"      row will be the same color.
  94. 690 print"     to quit playing and try again
  95. 695 [153]"         press the fire button
  96. 700 print"[158]       please wait.....setting up
  97. 705 [143]
  98. 720 [129]i[178]1[164]gn:[143] setup winning grid
  99. 725 : [129]j[178]1[164]gn
  100. 730 :   cg$(i,j)[178][199](65[170](i[171]1)[172]gn[170](j[171]1))
  101. 735 :   pg$(i,j)[178]" "
  102. 740 : [130]
  103. 745 [130]:cg$(gn,gn)[178]" "
  104. 755 [143]
  105. 770 [129]i[178]65[164]63[170]gn[172]gn:[143] setup playing grid
  106. 775 : x[178][181]([187](1)[172](gn[171]1)[170]1.5)
  107. 780 : y[178][181]([187](1)[172](gn[171]1)[170]1.5)
  108. 785 : [139]x[172]y[178]gn[172]gn[167]775
  109. 790 : [139]pg$(x,y)[179][177]" "[167]775
  110. 795 : pg$(x,y)[178][199](i)
  111. 800 [130]
  112. 820 [141]135:[143] wait for fire button
  113. 825 [143]
  114. 830 hp[178]((38[171]gn[172]4)[173]2):vp[178]((26[171]gn[172]4)[173]2)
  115. 840 [143]
  116. 845 [153]"loadsys";[200](dn$,vp);:[143] print finished grid
  117. 850 [153][166]hp);"or";[201]("tantantan=tantantan=tantantan=tantantan=tantantan^",4[172]gn)
  118. 855 [129]i[178]1[164]gn
  119. 860 : [129]j[178]1[164]3
  120. 865 :   [153][166]hp);"(NULL)";[201]("   (NULL)   (NULL)   (NULL)   (NULL)   (NULL)",4[172]gn)
  121. 870 : [130]
  122. 875 : [153][166]hp);"-";[201]("tantantan(NULL)tantantan(NULL)tantantan(NULL)tantantan(NULL)tantantan<",4[172]gn)
  123. 880 [130]
  124. 885 [153]"on";[166]hp);"/";[201]("tantantan>tantantan>tantantan>tantantan>tantantanexp",4[172]gn)
  125. 890 [143]
  126. 905 [129]tx[178]1[164]gn:[143] print grid letters
  127. 910 : [129]ty[178]1[164]gn
  128. 915 :   a$[178]pg$(tx,ty)
  129. 920 :   [141]170
  130. 925 : [130]
  131. 930 [130]
  132. 935 [143]
  133. 940 [137]210:[143] goto main loop
  134.