VARIABLES
J score
R record
H time
O upper border base address
D lower border base address
W good cell character (111)
M virus cell character (15)
N space character (32)
S status of the cursor keys
L flag for power-up (0: off, -1: on)
Y number of good cells spawned by the player when ingesting a good cell
X candidate position for the growth of 4 new virus cells or new power-up 
P player's position
Q candidate new player's position
Z probability of not spawning a power-up cells and probability of not attempting to spawn 4 new virus cells at random positions


CODE
0DEFINTA-Y:H=0:KEYOFF:SCREEN1:COLOR14,1,1:W=111:O=6207:VPOKE8218,78:IFJ>RTHENR=J
1DEFFNR(X)=RND(W)*X:M=15:N=32:FORI=0TO10:FORZ=0TO19:G=O+1+I*64+FNR(N):VPOKEG,M
2VPOKEG+N,W:NEXT:NEXT:Z=1:D=6880:FORI=0TO31:VPOKEO-I,215:VPOKED+I,215:NEXT:A=49
3B=8192:VPOKEB+1,129:V=177:Y=N:VPOKE8205,113:P=6544:J=0:C=128:IFSTRIG(0)=0GOTO3
4Y=Y+L:LOCATE0,0:?"SCORE"J"  HI"R" TI"H:S=STICK(0):IFRND(N)>ZTHENVPOKEX,191
5Z=Z-.0001:IFSTHENVPOKEP,N:Q=P+(S=7)-(S=3)+N*(S=1)-N*(S=5):IFVPEEK(Q)<>MTHENP=Q
6VPOKE8215,V+K:X=O+33+FNR(608):IFVPEEK(P)=191THENY=MELSEIFRND(N)>ZTHENVPOKEX,M
7K=16*(HAND1):H=H+1:IFVPEEK(P)=WTHENJ=J+1:FORI=0TOY:VPOKEO+1+FNR(672),W:NEXT:H=0
8L=(Y>4):VPOKEP,2:IFVPEEK(X)=MTHENVPOKEX-1,M:VPOKEX+1,M:VPOKEX-N,M:VPOKEX+N,M
9VPOKEB,A-C*L:ON-(P<DANDP>OANDH<99)GOTO4:?"GAME OVER":BEEP:FORI=0TOB:NEXT:GOTO0


COMMENTED, EXTENDED AND INDENTED CODE
0

// Declare integer variables
DEFINTA-Y:

// Initialization
H=0:

// Remove keys from 
KEYOFF:

// Set screen mode and some colors
SCREEN1:COLOR14,1,1:

// Initialization
W=111:O=6207:

// Set color for borders
VPOKE8218,78:

// Check if new record is set. Set record if necessary
IFJ>RTHENR=J

1

// Define random integer function
DEFFNR(X)=RND(N)*X:

// Initialization
M=15:N=32:

// Generate initial virus and good cells
FORI=0TO10:
    FORZ=0TO19:
        G=O+1+I*64+FNR(N)
        VPOKEG,M:
2

        VPOKEG+N,W:
    NEXT:
NEXT:

// Initialization
Z=1:D=6880

// Draw walls
FORI=0TO31:VPOKEO-I,215:VPOKED+I,215:NEXT

// Initialization
A=49

3

// Initialization
B=8192:

// Set color for virus cells
VPOKEB+1,129:

// Initialization
V=177:Y=30:

// Set color for good cells 
VPOKE8205,113:

// Initialize player's position
P=6544:

// Set score to zero
J=0:

// Initialization
C=128

// Wait for space bar pressed
IFSTRIG(0)=0GOTO3

4 -- MAIN GAME LOOP

    // Set number of generated good cells
    Y=Y+L:

    // Display score, record, time
    LOCATE0,0:?"SCORE"J"  HI"R" TI"H

    // Read status of the cursor keys
    S=STICK(0):

    // With 1-Z probability, generate a new energizing
    IFRND(N)>ZTHENVPOKEX,191

    5
    // Decrease the probability of not generating new spontaneous virus cells and new energizing cells
    Z=Z-.0001:

    // If cursor-key pressed, then delete player, compute new position, if new position not on virus cell, then update position
    IFSTHEN
        VPOKEP,N:
        Q=P+(S=7)-(S=3)+N*(S=1)-N*(S=5):
        IFVPEEK(Q)<>MTHEN
            P=Q

    6

    // Set 
    VPOKE8215,V+K:

    // Compute position of candidate pivot virus or power-up 
    X=O+33+FNR(608):

    // If player on power-up, then increase player's power to M (15)
    IFVPEEK(P)=191THEN
        Y=M
    // Otherwise with probability 1-Z, create a new virus cell
    ELSEIFRND(N)>ZTHEN
        VPOKEX,M

    7

    // Compute color code for player (yellow if under the effect of the power-up, green otherwise)
    K=16*(HAND1):

    // Increase time
    H=H+1:

    // If player on good cell, then increase score, generate Y+1 good cells at random positions, reset time to zero
    IFVPEEK(P)=WTHEN
        J=J+1:
        FORI=0TOY:VPOKEO+1+FNR(672),W:NEXT:
        H=0

    8

    // Compute flag for power-up (-1) and not on power-up (0)
    L=(Y>4):

    // Display player
    VPOKEP,2:

    // If random point X on a virus cell, then multiply this cell by four
    IFVPEEK(X)=MTHEN
        VPOKEX-1,M:VPOKEX+1,M:VPOKEX-N,M:VPOKEX+N,M

    9

    // Set player's color
    VPOKEB,A-C*L:

// If time has not reached 99, or player not on border, then restart main loop
ON-(P<DANDP>OANDH<99)
    GOTO4:
// Otherwise, display "GAME OVER", beep, pause, restart game
    ?"GAME OVER":BEEP:FORI=0TOB:NEXT:GOTO0
