home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1985 June / 1985-06.d64 / squares (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  2KB  |  72 lines

  1. 10 poke53281,0:poke53280,0:print"[147]"
  2. 20 dimin(15,4):fora=984to1023:pokea,32:next
  3. 30 dr(0)=-40:dr(1)=1:dr(2)=40:dr(3)=-1
  4. 40 cl(1)=3:cl(2)=4:cl(3)=11:cl(4)=9
  5. 50 p(1)=1360:p(2)=1358:p(3)=1440:p(4)=1438:co=54272
  6. 60 forx=1to4:p(x)=1024+int(rnd(1)*15)*2+int(rnd(1)*10)*80:next
  7. 70 goto560
  8. 80 print"[147]";:forx=1to10:fory=1to15:print"[209] ";:next:print:print:next
  9. 90 gosub630:printtab(22);" i[157][157]j[219]k[157][157]m"
  10. 100 qf=1:forpl=1to4:p=p(pl):cl=cl(pl):q=0:fl=0
  11. 110 p1=p:gosub380:p2=si:lf=0
  12. 120 gosub470:gosub630:print"player"pl"'s turn";:poke646,cl:print"  [209]"
  13. 130 print "                     "
  14. 140 gosub380
  15. 150 in=in(si,pl):ifin=0thengosub290
  16. 160 goto500
  17. 170 ifabs(in)=1thenpokep+in,67:goto190
  18. 180 pokep+in,66
  19. 190 pokep+co,1:pokep+co+in*2,cl:pokep+in+co,cl
  20. 200 p(pl)=p+in*2:gosub410
  21. 210 if(s1=15)and(peek(x+d)=32)thenpokex+d,160:pokex+d+co,cl:b(pl)=b(pl)+1
  22. 220 if(s2=15)and(peek(x-d)=32)thenpokex-d,160:pokex-d+co,cl:b(pl)=b(pl)+1
  23. 230 p=p(pl):gosub520
  24. 240 gosub380:ifp1=pandp2=sithenlf=1:q=9
  25. 250 ifq=>9then270
  26. 260 q=q+1:goto140
  27. 270 iflf=0thenqf=0
  28. 280 nextpl:goto640
  29. 290 gosub630:print"what direction":pokep+co,cl:poke198,0
  30. 300 ifty(pl)=2thengosub340:q=10:goto330
  31. 310 geta$:ifa$<>"i"anda$<>"m"anda$<>"j"anda$<>"k"then310
  32. 320 q=10:d=(a$="j")*-3+(a$="k")*-1+(a$="m")*-2
  33. 330 in(si,pl)=dr(d):in=in(si,pl):return
  34. 340 ifsi=15thend=int(rnd(1)*4):return
  35. 350 iffl=>4thend=int(rnd(1)*4):return
  36. 360 d=int(rnd(1)*4):if(siand2^d)=2^dthen360
  37. 370 fl=fl+1:return
  38. 380 si=0:forx=0to3:i=peek(dr(x)+p)
  39. 390 ifi<>32thensi=si+2^x
  40. 400 next:return
  41. 410 s1=0:s2=0:x=(p(pl)+p)/2:ifabs(x-p)=1thend=40:goto430
  42. 420 d=1
  43. 430 fory=0to3:z=peek(x+dr(y)+d):if(z=66)or(z=67)thens1=s1+2^y
  44. 440 next
  45. 450 fory=0to3:z=peek(x+dr(y)-d):ifz=(66)or(z=67)thens2=s2+2^y
  46. 460 next:return
  47. 470 gosub630:print"                   "
  48. 480 print"                  "
  49. 490 print"                  ":goto520
  50. 500 ifpeek(p+in*2)=81then170
  51. 510 gosub630:print:gosub480:gosub630:print"illegal move":gosub290:goto140
  52. 520 print"":forx=1to4
  53. 530 print tab(29);" plr."x;:poke646,cl(x):print"[209]"
  54. 540 printtab(30);b(x):next
  55. 550 return
  56. 560 print"[147][129]"spc(16)"squares"
  57. 570 print"          [159]1. player controlled
  58. 580 [153]"          2. computer controlled
  59. 590 forx=1to4
  60. 600 print"[158]        snake "x" (choose 1 or 2)"
  61. 610 geta$:ifval(a$)>2orval(a$)=0then610
  62. 620 ty(x)=val(a$):next:goto80
  63. 630 print"":forqq=1to18:print:next:return
  64. 640 ifqf=0then100
  65. 650 print"[147]"spc(14)"[129]game over!"
  66. 660 forx=1to4:poke 646,cl(x):printtab(7)"player"x;"...."b(x)" squares"
  67. 670 next
  68. 680 print""spc(10)"another game? (y/n)":poke198,0
  69. 690 geta$:ifa$="y"thenrun
  70. 700 ifa$="n"thenprint"[147]":end
  71. 710 goto690
  72.