QB board game

QuickBasic program. A game I made that was inspired by another game called "proximity" using the "enemy territories: weaken" setting. (to play, save the following text as a ".BAS" file, open it with qb45.exe, and hit shift+F5)

'WASD moves your cursor (the yellow dot)
'spacebar selects the square to move in
DIM grid(9, 15)
DIM cols(9, 15)
RANDOMIZE TIMER
x = 1
y = 1
SCREEN 13
FOR a = 1 TO 14 STEP 2
LINE (0, (a - 1) * 10)-(300, a * 10), 15, B '
NEXT a '
FOR a = 1 TO 14 STEP 2 '
LINE (19, a * 10)-(319, (a + 1) * 10), 15, B '
NEXT a '
FOR a = 1 TO 13 STEP 2 'draw board
FOR b = 1 TO 13 STEP 2 '
LINE ((b + 1) * 19, (a - 1) * 10)-((b + 1) * 19, a * 10), 15 '
NEXT b, a '
FOR a = 2 TO 14 STEP 2 '
FOR b = 1 TO 13 STEP 2 '
LINE ((b + 2) * 19, (a - 1) * 10)-((b + 2) * 19, a * 10), 15 '
NEXT b, a '
q = INT(RND * 20) + 1 'pick random number for first move
t = 1 'initialize at blue's turn
top:
p = t 'new var to help with turn switch later
a\$ = INKEY\$
change = 0 'boolean for a change on the board
IF a\$ = "a" THEN x = x - 1
IF a\$ = "d" THEN x = x + 1
IF a\$ = "w" THEN y = y - 1 'check direction
IF a\$ = "s" THEN y = y + 1
IF x > 8 THEN x = x - 1
IF x < 1 THEN x = 1
IF y > 14 THEN y = y - 1 'cheange x or y based on a\$
IF y < 1 THEN y = 1
b = POINT((x - 1) * 38 + 20, (y - 1) * 10 + 1) 'var to avoid black dot behind
'cursor
PSET ((x - 1) * 38 + 20, (y - 1) * 10 + 2), 14 'yellow dot for cursor
IF a\$ = " " THEN
IF grid(x, y) = 0 THEN 'check to see if the space picked is open
change = 1 'change on board = true
PAINT ((x - 1) * 38 + 20, (y - 1) * 10 + 2), t, 15 'color box

IF grid(x - 1, y) <> 0 AND x - 1 > 0 THEN 'checks of all adj. boxes
IF cols(x - 1, y) = t THEN
grid(x - 1, y) = grid(x - 1, y) + 1
IF grid(x - 1, y) > 20 THEN grid(x - 1, y) = 20
PAINT ((x - 2) * 38 + 20, (y - 1) * 10 + 2), t, 15
ELSEIF cols(x - 1, y) <> t THEN
IF grid(x - 1, y) < q THEN
grid(x - 1, y) = grid(x - 1, y) - 1
IF grid(x - 1, y) <= 0 THEN grid(x - 1, y) = 1
cols(x - 1, y) = t
PAINT ((x - 2) * 38 + 20, (y - 1) * 10 + 2), t, 15
END IF
END IF
END IF
IF grid(x, y - 1) <> 0 AND y - 1 > 0 THEN
IF cols(x, y - 1) = t THEN
grid(x, y - 1) = grid(x, y - 1) + 1
IF grid(x, y - 1) > 20 THEN grid(x, y - 1) = 20
PAINT ((x - 1) * 38 + 20, (y - 2) * 10 + 2), t, 15
ELSEIF cols(x, y - 1) <> t THEN
IF grid(x, y - 1) < q THEN
grid(x, y - 1) = grid(x, y - 1) - 1
IF grid(x, y - 1) <= 0 THEN grid(x, y - 1) = 1
cols(x, y - 1) = t
PAINT ((x - 1) * 38 + 20, (y - 2) * 10 + 2), t, 15
END IF
END IF
END IF
IF grid(x, y + 1) <> 0 AND y + 1 < 14 THEN
IF cols(x, y + 1) = t THEN
grid(x, y + 1) = grid(x, y + 1) + 1
IF grid(x, y + 1) > 20 THEN grid(x, y + 1) = 20
PAINT ((x - 1) * 38 + 20, y * 10 + 2), t, 15
ELSEIF cols(x, y + 1) <> t THEN
IF grid(x, y + 1) < q THEN
grid(x, y + 1) = grid(x, y + 1) - 1
IF grid(x, y + 1) <= 0 THEN grid(x, y + 1) = 1
cols(x, y + 1) = t
PAINT ((x - 1) * 38 + 20, y * 10 + 2), t, 15
END IF
END IF
END IF
IF grid(x + 1, y) <> 0 AND x + 1 < 9 THEN
IF cols(x + 1, y) = t THEN
grid(x + 1, y) = grid(x + 1, y) + 1
IF grid(x + 1, y) > 20 THEN grid(x + 1, y) = 20
PAINT (x * 38 + 20, (y - 1) * 10 + 2), t, 15
ELSEIF cols(x + 1, y) <> t THEN
IF grid(x + 1, y) < q THEN
grid(x + 1, y) = grid(x + 1, y) - 1
IF grid(x + 1, y) <= 0 THEN grid(x + 1, y) = 1
cols(x + 1, y) = t
PAINT (x * 38 + 20, (y - 1) * 10 + 2), t, 15
END IF
END IF
END IF
IF grid(x + 1, y + 1) <> 0 AND x + 1 < 9 AND y + 1 < 15 AND y MOD 2 = 0 THEN
IF cols(x + 1, y + 1) = t THEN
grid(x + 1, y + 1) = grid(x + 1, y + 1) + 1
IF grid(x + 1, y + 1) > 20 THEN grid(x + 1, y + 1) = 20
PAINT (x * 38 + 20, y * 10 + 2), t, 15
ELSEIF cols(x + 1, y + 1) <> t THEN
IF grid(x + 1, y + 1) < q THEN
grid(x + 1, y + 1) = grid(x + 1, y + 1) - 1
IF grid(x + 1, y + 1) <= 0 THEN grid(x + 1, y + 1) = 1
cols(x + 1, y + 1) = t
PAINT (x * 38 + 20, y * 10 + 2), t, 15
END IF
END IF
END IF
IF grid(x + 1, y - 1) <> 0 AND x + 1 < 9 AND y - 1 > 0 AND y MOD 2 = 0 THEN
IF cols(x + 1, y - 1) = t THEN
grid(x + 1, y - 1) = grid(x + 1, y - 1) + 1
IF grid(x + 1, y - 1) > 20 THEN grid(x + 1, y - 1) = 20
PAINT (x * 38 + 20, (y - 2) * 10 + 2), t, 15
ELSEIF cols(x + 1, y - 1) <> t THEN
IF grid(x + 1, y - 1) < q THEN
grid(x + 1, y - 1) = grid(x + 1, y - 1) - 1
IF grid(x + 1, y - 1) <= 0 THEN grid(x + 1, y - 1) = 1
cols(x + 1, y - 1) = t
PAINT (x * 38 + 20, (y - 2) * 10 + 2), t, 15
END IF
END IF
END IF
IF grid(x - 1, y + 1) <> 0 AND x - 1 > 0 AND y + 1 < 15 AND y MOD 2 = 1 THEN
IF cols(x - 1, y + 1) = t THEN
grid(x - 1, y + 1) = grid(x - 1, y + 1) + 1
IF grid(x - 1, y + 1) > 20 THEN grid(x - 1, y + 1) = 20
PAINT ((x - 2) * 38 + 20, y * 10 + 2), t, 15
ELSEIF cols(x - 1, y + 1) <> t THEN
IF grid(x - 1, y + 1) < q THEN
grid(x - 1, y + 1) = grid(x - 1, y + 1) - 1
IF grid(x - 1, y + 1) <= 0 THEN grid(x - 1, y + 1) = 1
cols(x - 1, y + 1) = t
PAINT ((x - 2) * 38 + 20, y * 10 + 2), t, 15
END IF
END IF
END IF
IF grid(x - 1, y - 1) <> 0 AND x - 1 > 0 AND y - 1 > 0 AND y MOD 2 = 1 THEN
IF cols(x - 1, y - 1) = t THEN
grid(x - 1, y - 1) = grid(x - 1, y - 1) + 1
IF grid(x - 1, y - 1) > 20 THEN grid(x - 1, y - 1) = 20
PAINT ((x - 2) * 38 + 20, (y - 2) * 10 + 2), t, 15
ELSEIF cols(x - 1, y - 1) <> t THEN
IF grid(x - 1, y - 1) < q THEN
grid(x - 1, y - 1) = grid(x - 1, y - 1) - 1
IF grid(x - 1, y - 1) <= 0 THEN grid(x - 1, y - 1) = 1
cols(x - 1, y - 1) = t
PAINT ((x - 2) * 38 + 20, (y - 2) * 10 + 2), t, 15
END IF
END IF
END IF

grid(x, y) = q 'place the "TO PLACE" number in the # DIM
cols(x, y) = t 'place the color number in color DIM
q = INT(RND * 20) + 1 'pick new random number
IF p = 1 THEN t = 4 'switches turn
IF p = 4 THEN t = 1 'needs two vars to prevent switching back
END IF
END IF
FOR d = 1 TO 32000: NEXT d 'delay
PSET ((x - 1) * 38 + 20, (y - 1) * 10 + 2), b 'colors back over cursor
COLOR 15
LOCATE 20, 1
PRINT "TO PLACE: "; 'printing of nums
COLOR t 'on bottom
PRINT q 'of screen
IF cols(x, y) <> 0 THEN
COLOR 15: PRINT "SELECTED: "; : COLOR cols(x, y): PRINT grid(x, y)
ELSE PRINT " "
END IF
IF change = 1 THEN
COLOR 15: PRINT "SCORES: ";
red = 0: blue = 0
blocks = 0
FOR a = 1 TO 8
FOR b = 1 TO 14
IF grid(a, b) <> 0 THEN
blocks = blocks + 1 'counts number of boxes filled
IF cols(a, b) = 1 THEN blue = blue + grid(a, b)
IF cols(a, b) = 4 THEN red = red + grid(a, b) 'calc scores
END IF
NEXT b, a
COLOR 1: PRINT blue; " "; 'print scores
COLOR 4: PRINT red
IF blocks = 8 * 14 THEN GOTO endgame 'end check
END IF
GOTO top
endgame:
COLOR 14
IF red > blue THEN
PRINT "RED WINS!!!" 'duh
ELSEIF blue > red THEN
PRINT "BLUE WINS!!!"
ELSE
PRINT "TIE!!!"
END IF