Compucolor.org – Virtual Media

Listing of file='SNAKE.BAS;01' on disk='vmedia/zip_compiler-sector.ccvf'

5 PLOT 12,3,24,6:PRINT "S N A K E"
6 PLOT 3,4,12:PRINT "YOUR SNAKE MUST NEVER CROSS THE PATH OF EITHER SNAKE"
7 PLOT 3,28,15:PRINT "8"
8 PRINT :PRINT "		    < - 4	6 - >"
11 PLOT 3,28,19:PRINT "2"
12 PLOT 3,4,22:INPUT "HIT RETURN ...";J
18 SS= 0:YS= 0:FOR I= 0TO PEEK (33209)+ 11:J= RND (1):NEXT
30 N= 0:PLOT 6,2,12,27,24:DIM S(63,31)
33 PRINT "  WAIT"
36 FOR I= 0TO 31:FOR J= 0TO 63:S(J,I)= 0:NEXT :PLOT 3,2,2,14:PRINT 32- I" ":NEXT
39 PLOT 12,3,32,0,14:PRINT "SNAKE.."SS"   YOU.."YS"  "
40 D= 6:X1= 31:Y1= 15:F= 6:G= 29:H= 17:C= 47:POKE 33278,0
50 GOSUB 1000:GOSUB 2000:GOSUB 3000:FOR I= 1TO N:NEXT
70 A= X1:B= Y1:M= D:X1= G:Y1= H:C= 24:D= F
80 GOSUB 4000:GOSUB 2000:GOSUB 3000
90 G= X1:H= Y1:F= D:X1= A:Y1= B:C= 47:D= M:GOTO 50
1000 J= PEEK (33278):IF J= 0THEN RETURN
1025 IF INT ((J- 48)/ 2)= (J- 48)/ 2THEN D= J- 48
1030 POKE 33278,0:RETURN
2000 X= X1:Y= Y1
2010 IF D= 2THEN Y1= Y+ 1:IF Y1> 31THEN Y1= Y1- 32
2020 IF D= 6THEN X1= X+ 1:IF X1> 63THEN X1= X1- 64
2030 IF D= 8THEN Y1= Y- 1:IF Y1< 0THEN Y1= Y1+ 32
2040 IF D= 4THEN X1= X- 1:IF X1< 0THEN X1= X1+ 64
2060 IF S(X1,Y1)GOTO 2200
2100 S(X1,Y1)= C:RETURN
2200 PLOT 14,6,17:PRINT :PRINT
2205 IF C= 47THEN SS= SS+ 1:PRINT "SNAKE WINS"
2210 IF C= 24THEN YS= YS+ 1:PRINT "YOU WIN"
2220 PLOT 15,6,6,8:GOTO 33
3000 PLOT 3,X,Y,6,C:PRINT "X";:PLOT 3,X1,Y1:PRINT " ";:PLOT 8:PRINT "":RETURN
4000 X2= (X1+ 1)AND (X1< 63):X3= (X2+ 1)AND (X2< 63)
4025 X4= X1- 1:IF X4< 0THEN X4= 63
4028 X5= X4- 1:IF X5< 0THEN X5= 63
4030 Y2= (Y1+ 1)AND (Y1< 31):Y3= (Y2+ 1)AND (Y2< 31)
4035 Y4= Y1- 1:IF Y4< 0THEN Y4= 31
4038 Y5= Y4- 1:IF Y5< 0THEN Y5= 31
4040 J= RND (1)* 10:IF J> 7THEN GOSUB 5000
4050 IF D= 6THEN IF NOT (S(X2,Y1)> 0OR S(X3,Y1)> 0)THEN 4280
4055 IF D= 6THEN GOSUB 4900
4060 IF D= 8THEN IF NOT (S(X1,Y4)> 0OR S(X1,Y5)> 0)THEN 4280
4065 IF D= 8THEN GOSUB 4900
4070 IF D= 2THEN IF NOT (S(X1,Y2)> 0OR S(X1,Y3)> 0)THEN 4280
4075 IF D= 2THEN GOSUB 4900
4080 IF D= 4THEN IF NOT (S(X4,Y1)> 0OR S(X5,Y1)> 0)THEN 4280
4085 IF D= 4THEN GOSUB 4900
4090 IF CT> 20GOTO 4700
4100 GOTO 4050
4280 CT= 0:RETURN
4700 CT= 0
4750 IF D= 6THEN IF NOT S(X2,Y1)THEN 4280
4755 IF D= 6THEN GOSUB 4900
4760 IF D= 8THEN IF NOT S(X1,Y4)THEN 4280
4765 IF D= 8THEN GOSUB 4900
4770 IF D= 2THEN IF NOT S(X1,Y2)THEN 4280
4775 IF D= 2THEN GOSUB 4900
4780 IF D= 4THEN IF NOT S(X4,Y1)THEN 4280
4785 IF D= 4THEN GOSUB 4900
4790 IF CT> 50THEN D= 2:RETURN
4800 GOTO 4750
4900 CT= CT+ 1
5000 D= INT (RND (1)* 4+ 1)* 2
5020 RETURN