A downloadable game

VIC SNAKE

VIC SNAKE is a 2 player Snake game for the unexpanded VIC 20. One player will use the joystick while the other player will use the keyboard. Red snake uses the keyboard with Keys W A Z and S to change snake direction. The game is played the same as the SNAKE for C64. 


1 G=7680:C=30720:POKE36879,26:N$=CHR$(18)+"BLUE:":M$="RED:":R=3:Q=37151:B=4:J=11

G is upper left of screen memory. C is color memory, n$ is score line text

2 PRINT"{BLK}{CLR/HOME}": FORX=GTOG+21:POKEX,160:POKEX+484,160:POKEC+X,0:POKEC+X+484,0:NEXT:I=18: PRINT"S ";N$;U;M$;V

Print color and clr home. Place top/bottom border around screen, Print scores. I is Red X position. Note, you must use abbreviations in this line to fit all commands on one line. PshiftO for poke, FshiftO for FOR, ? for print.

3 FORY=GTO8164STEP22:POKEY,160:POKEY+21,160:POKEC+Y,0:POKEC+Y+21,0:NEXT:X=4:Y=11:GOTO7

Place side borders around screen, initialize location and headings. X/Y are blue position, I/J are Red Position. B is blue heading (4 is to the right), R is red’s heading (3 is to the left)

4 POKEG+S,218:B=-B*(D=0)-D*(D>0):X=X-(B=4)+(B=3):Y=Y-(B=2)+(B=1)

Place Blue snake head at X/Y position on screen (S is computed from X/Y). Update Blue Direction based on latest joystick read (D). 1 is up, 2 is down, 3 is left, 4 is right

5 GETA$:D=-(A$="W")-(A$="Z")*2-(A$="A")*3-(A$="S")*4:Z=SQR(3e3)

Read keyboard for red snake move

6 POKET+G,218:R=-R*(D=0)-D*(D>0):I=I-(R=4)+(R=3):J=J-(R=2)+(R=1)

Place Red Snake head on screen based on I/J location. T is computed from I/J position. Update Red Snake Direction based on latest joystick read.

7 S=X+Y*22:T=I+J*22:POKEC+G+S,6:IF(PEEK(G+S)<>32)THEV=V+1:PRINT"RED WINS":GOTO10

S is the location on the screen given the X and Y value. T is location on screen for red snake given its X/Y location stored as I/J. Check new Blue location for space if not a space (32) then blue hit something and red wins. Increment red score (V)

8 Z=SQR(7):POKES+G,90:POKEC+G+T,2:IF(PEEK(G+T)<>32)THENU=U+1:PRINT"BLUE WINS!!!":GOTO10

SQR function is just to slow things down a bit. Poke S+G Adds segment to Blue snake. If new position of red snake is not empty, then red hit something and blue wins. Add one to blue’s score (u)

9 POKET+G,90:P=31AND(255-PEEK(Q)):D=-P*(P<3)-(P=4)*3-(P=8)*4:GOTO4

Place RED snake head and read Blue Joystick.

10 FOR M=1to2000:NEXT:J=11:B=4:R=3:GOTO2

Delay slightly before starting next round. 

Download

Download
Prosser 2023 10 line.docx 537 kB
Download
Prosser2023.d64 170 kB
Download
VIC SNAKE.txt 2.4 kB

Install instructions

To play: 

LOAD”VIC SNAKE”,8

Then type RUN and return

Leave a comment

Log in with itch.io to leave a comment.