home *** CD-ROM | disk | FTP | other *** search
/ Commodore Disk User Volume 2 #1 / Commodore_Disk_User_Vol.2_1_1988_-.d64 / addit (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  3KB  |  91 lines

  1. 10 rem **    addit     **
  2. 20 rem ** by d.butcher **
  3. 30 poke53280,0:poke53281,0:printchr$(142)chr$(8):dima(64),b(7,7)
  4. 40 print"[147]"tab(17)"[158]addit":b$="                                       "
  5. 50 b1$="[176][192][192][178][192][192][178][192][192][178][192][192][178][192][192][178][192][192][178][192][192][178][192][192][174]":b2$="[221]  [221]  [221]  [221]  [221]  [221]  [221]  [221]  [221]"
  6. 60 b3$="[171][192][192][219][192][192][219][192][192][219][192][192][219][192][192][219][192][192][219][192][192][219][192][192][179]":b4$="[173][192][192][177][192][192][177][192][192][177][192][192][177][192][192][177][192][192][177][192][192][177][192][192][189]"
  7. 70 d$="":l$=left$(d$,22)
  8. 80 print"do you require instructions (y/n) ? ";:gosub720:printa$:ifa$="y"thengosub760
  9. 90 print"how many players ? ";:gosub740:printa$:n=val(a$):ifn=2then110
  10. 100 print:input"what is your name ";p1$:p2$="the computer":goto130
  11. 110 print:input"what is your name, player 1 ";p1$
  12. 120 print:input"what is your name, player 2 ";p2$:p2$=left$(p2$,12)
  13. 130 p1$=left$(p1$,12):n1=25+int((15-len(p1$))/2):n2=25+int((15-len(p2$))/2)
  14. 140 print"[147]"b1$:fory=0to6:printb2$:printb3$:next
  15. 150 printb2$:printb4$:print""tab(29)"scores":printtab(29)"[192][192][192][192][192][192]"
  16. 160 printleft$(d$,6)tab(n1)p1$:printleft$(d$,12)tab(n2)p2$:n3=n1-20:n4=n2-20
  17. 170 printl$tab(10)"please wait a moment"
  18. 180 r=1:forc=1to64:a(c)=c:next:forc=64to1step-1:readd:e=int(rnd(0)*c)+1:v=a(e)-1
  19. 190 ife<cthenforh=etoc-1:a(h)=a(h+1):next
  20. 200 h=int(v/8):v=v-8*h:b(h,v)=d:gosub330:next:s1=0:s2=0:gosub590
  21. 210 p=1:gosub380:iff=0then230
  22. 220 p=2:gosub400:iff<>0then210
  23. 230 printl$b$l$;:onsgn(s2-s1)+2gosub260,290,300
  24. 240 printd$tab(10)"another game (y/n) ?";:gosub720:ifa$="y"thenrestore:goto140
  25. 250 print"[147]"chr$(9):end
  26. 260 t=20-int((len(p1$)+17)/2):printtab(t)p1$" won by"(s1-s2)"point";
  27. 270 ifs1-s2>1thenprint"s"
  28. 280 return
  29. 290 printtab(12)"it's a draw !             ":return
  30. 300 t=20-int((len(p2$)+17)/2):printtab(t)p2$" won by"(s2-s1)"point";
  31. 310 ifs2-s1>1thenprint"s"
  32. 320 return
  33. 330 cd=h*2+2:l1$=left$(d$,cd):cr=v*3+1:d=b(h,v)
  34. 340 printl1$tab(cr)"[146]";:ifr=2thenprint"";
  35. 350 ifd=50thenprint"**[146]":b1=h:b2=v:return
  36. 360 ifd=-50thenprint"  [146]":return
  37. 370 printright$("  "+str$(d),2)"[146]":return
  38. 380 f=300:forv=0to7:f=f+b(b1,v):next:iff=0thenreturn
  39. 390 n$=p1$:xx=1:yy=0:gosub420:return
  40. 400 f=300:forh=0to7:f=f+b(h,b2):next:iff=0thenreturn
  41. 410 n$=p2$:xx=0:yy=1:gosub420:return
  42. 420 y=b1:x=b2:ifn=2orp=1then440
  43. 430 printl$b$l$tab(12)"i'm thinking....":gosub600:goto540
  44. 440 t=20-int((len(n$)+12)/2):printl$b$l$tab(t)"your turn, "n$
  45. 450 geta$:ifa$=""then450
  46. 460 ifa$<>" "then520
  47. 470 x1=x:y1=y
  48. 480 y=y+yy:ify>7theny=0
  49. 490 x=x+xx:ifx>7thenx=0
  50. 500 z=b(y,x):ifabs(z)=50then480
  51. 510 r=1:h=y1:v=x1:gosub330:r=2:h=y:v=x:gosub330:goto450
  52. 520 ifa$<>chr$(13)then450
  53. 530 ifabs(b(y,x))=50then450
  54. 540 ifn=1andp=2thenr=2:h=y:v=x:gosub330
  55. 550 r=1:h=b1:v=b2:b(h,v)=-50:gosub330:h=y:v=x:z=b(h,v):b(h,v)=50:gosub330
  56. 560 ifp=1thens1=s1+z
  57. 570 ifp=2thens2=s2+z
  58. 580 printleft$(d$,19)tab(13)"last taken :"z"[157] "
  59. 590 printleft$(d$,8)tab(30)s1"[157] ":printleft$(d$,14)tab(30)s2"[157] ":return
  60. 600 m=-50:g=-1:fora1=0to7:d=b(a1,b2):ifabs(d)=50then710
  61. 610 x2=-50:fora2=0to7:ifa2<>b2thenk=b(a1,a2):ifk<>-50andk>x2thenx2=k:s=a2
  62. 620 next:ifx2<>-50then640
  63. 630 ifd>mthenm=d:g=a1:goto710
  64. 640 ifg<0theng=a1
  65. 650 fora2=0to7:q=b(a2,s):ifq=-50ora2=a1then700
  66. 660 y2=-50:fora3=0to7:w=b(a2,a3):ifa3=sthen680
  67. 670 ifabs(w)<>50andw>y2theny2=w
  68. 680 next:ify2=-50theny2=0
  69. 690 l=d-x2+q-y2:ifl>mthenm=l:g=a1
  70. 700 next
  71. 710 next:y=g:return
  72. 720 geta$:ifa$<>"y"anda$<>"n"then720
  73. 730 return
  74. 740 geta$:ifa$<>"1"anda$<>"2"then740
  75. 750 return
  76. 760 print" addit is a board game for 1-2 players."
  77. 770 print" every square on the board has a value,"
  78. 780 print" and you score points by landing on the"
  79. 790 print" squares. you may move in one direction"
  80. 800 print" only - horizontally or vertically. you"
  81. 810 print" must press the space  bar to move from"
  82. 820 print" square to square and then press return"
  83. 830 print" to score, but beware - some squares on"
  84. 840 print" the board contain minus values !"
  85. 850 printtab(6)"press space bar to continue."
  86. 860 geta$:ifa$<>" "then860
  87. 870 print"[147]":return
  88. 880 data15,10,9,9,8,8,7,7,7,6,6,6,5,5,5,5,4,4,4,4,3,3,3,3,3
  89. 890 data2,2,2,2,2,1,1,1,1,1,0,0,0,0,0,-1,-1,-1,-1,-2,-2,-2,-2
  90. 900 data-3,-3,-3,-3,-4,-4,-4,-5,-5,-5,-6,-6,-7,-7,-9,50
  91.