strange errors

i am working on a program in computer science. for some reason i keep getting an unspecified error at a random line with print, clear, or plot text

the error code is -11500, any ideas?

EDIT:oh yea and its happening at if statements and set back statments too

Comments

the code

here is the code

!window info
!
! _______________________________________________________________________________
!|window#| |1 |2 |3 |4 |5 |6 |
!|_______|_|___________|____|___________________________|_____|_________|________|
!|use | |player name|exit|background and num of moves|board|ok button|new game|
!|_______|_|___________|____|___________________________|_____|_________|________|
!|xmin | |0 |0.75|0 |0.1 |0.91 |0.91 |
!|_______|_|___________|____|___________________________|_____|_________|________|
!|xmax | |1 |0.95|1 |0.9 |1 |1 |
!|_______|_|___________|____|___________________________|_____|_________|________|
!|ymin | |0.75 |0.8 |0 |0.1 |0.55 |0.45 |
!|_______|_|___________|____|___________________________|_____|_________|________|
!|ymax | |1 |0.95|0.75 |0.65 |0.6 |0.5 |
!|_______|_|___________|____|___________________________|_____|_________|________|
!

DIM game$(1,1),r(1,1),g(1,1),b(1,1)

LET sxmax=12
LET symax=12

MAT redim game$(sxmax,symax),r(sxmax,symax),g(sxmax,symax),b(sxmax,symax)

DIM v(1)
LET fn$ = "Matisse ITC" ! Or any other font available on your machine
LET fs$ = "Bold" ! Or Plain, Italic, BoldItalic
LET v(1) = 18 ! Size in points, 1 pint = 1/72 inch
CALL Object (2, 0, "FONT NAME|FONT STYLE|FONT SIZE", fn$ & "|" & fs$, v())

SET COLOR MIX(22) 167/255,0,0
SET COLOR 22
SET BACK "black"
CLEAR

PRINT "Welcome to The Last Piece Game--"
PRINT " Click OK for next perosn's turn"
PRINT " Click NEW Game to reset a game session"
PRINT " click EXIT to end the program"

INPUT prompt "Player 1's name: " :p1$
INPUT prompt "Player 2's name: " :p2$
CLEAR

OPEN#1:screen 0,1,0.75,1
SET BACK "blue"
SET COLOR "black"

OPEN#2:screen 0.75,0.95,0.8,0.95
SET COLOR 22
SET BACK "black"

OPEN#3:screen 0,1,0,0.75
SET BACK "black"
SET COLOR "green"
CLEAR

OPEN#4:screen 0.1,0.9,0.1,0.65
SET WINDOW 0,sxmax,0,symax
SET BACK "white"

OPEN#5:screen 0.91,1,0.55,0.6
SET BACK "blue"
SET COLOR "green"

OPEN#6:screen 0.91,1,0.45,0.5
SET BACK "blue"
SET COLOR "green"

DO
LET player=0

FOR x=1 to sxmax
FOR y=1 to symax
RANDOMIZE
LET r(x,y)=rnd
LET g(x,y)=rnd
LET b(x,y)=rnd
IF int(rnd*6)+1=3 then
LET game$(x,y)="x"
LET r(x,y)=1
LET g(x,y)=1
LET b(x,y)=1
END IF
DO while r(x,y)=0 and g(x,y)=0 and b(x,y)=0
LET r(x,y)=rnd
LET g(x,y)=rnd
LET b(x,y)=rnd
LOOP
NEXT y
NEXT x

DO
WINDOW #0
LET fin=0
SET TEXT justify "center","half"
WINDOW #1
CLEAR

LET fn$ = "Matisse ITC" ! Or any other font available on your machine
LET fs$ = "Bold" ! Or Plain, Italic, BoldItalic
LET v(1) = 26 ! Size in points, 1 pint = 1/72 inch
CALL Object (2, 0, "FONT NAME|FONT STYLE|FONT SIZE", fn$ & "|" & fs$, v())

IF player=0 then
PLOT TEXT, AT 0.1,0.5: "player " &p1$& "'s turn"
ELSE
PLOT TEXT, AT 0.1,0.5: "player " &p2$& "'s turn"
END IF

WINDOW #2
CLEAR
PLOT TEXT, AT 0.5,0.5: "EXIT"

WINDOW #5
CLEAR
PLOT TEXT, AT 0.5,0.5: "OK"

WINDOW #4
CLEAR

FOR x=1 to sxmax
FOR y=1 to symax
SET COLOR MIX(23) r(x,y),g(x,y),b(x,y)
SET COLOR 23
BOX AREA x-1,x,y-1,y

LET fn$ = "Matisse ITC" ! Or any other font available on your machine
LET fs$ = "Bold" ! Or Plain, Italic, BoldItalic
LET v(1) = 26-symax ! Size in points, 1 pint = 1/72 inch
CALL Object (2, 0, "FONT NAME|FONT STYLE|FONT SIZE", fn$ & "|" & fs$, v())

IF game$(x,y)<>"x" then
IF r(x,y)+g(x,y)+b(x,y)<1.5 then
SET COLOR "white"
ELSE
SET COLOR "black"
END IF
PLOT TEXT, AT x-0.5,y-0.5: game$(x,y)
END IF
NEXT y
NEXT x

LET turns=int(rnd*4)+2
LET clicks=0

DO
LET valid=0
DO
WINDOW #0
GET MOUSE mx,my,mc
LOOP until mc<>0

IF clicks<>turns then
IF mx>=0.75 and mx<=0.95 and my>=0.8 and my<=0.95 then !window 2, exit
LET done=1
LET fin=1
LET valid=1
ELSEIF mx>=0.91 and mx<=1 and my>=0.55 and my<=0.6 then !window 5, ok button
IF clicks>0 and clicks<turns then
LET player=mod(player+1,2)
LET valid=1
END IF
ELSEIF mx>=0.91 and mx<=1 and my>=0.45 and my<=0.5 then !window 6, new game
LET done=1
LET valid=1
ELSEIF mx>=0.1 and mx<=0.9 and my>=0.1 and my<=0.65 then !and finally, window 4, the game board
LET x=0

LET found =0
LET blocked=0
DO
LET x=x+1
LET y=0
DO
LET y=y+1
IF mx>=x-1 and (mx<x or mx=sxmax) and my>=y-1 and (my<y or my=symax) then
IF player=0 then
LET t$="2"
ELSE
LET t$="1"
END IF

IF game$(x,y)<>"" or game$(x,y)="x" then
LET blocked=1
ELSE
IF x=1 then
IF y=1 then
IF (game$(x+1,y)<>t$ or game$(x+1,y)<>"x") and (game$(x,y+1)<>t$ or game$(x,y+1)<>"x") then
LET blocked=1
END IF
ELSEIF y=symax then
IF (game$(x+1,y)<>t$ or game$(x+1,y)<>"x") and (game$(x,y-1)<>t$ or game$(x,y-1)<>"x") then
LET blocked=1
END IF
ELSE
IF (game$(x+1,y)<>t$ or game$(x+1,y)<>"x") and (game$(x,y-1)<>t$ or game$(x,y-1)<>"x") and (game$(x,y+1)<>t$ or game$(x,y+1)<>"x") then
LET blocked=1
END IF
END IF
ELSEIF x=sxmax then
IF y=1 then
IF (game$(x-1,y)<>t$ or game$(x-1,y)<>"x") and (game$(x,y+1)<>t$ or game$(x,y+1)<>"x") then
LET blocked=1
END IF
ELSEIF y=symax then
IF (game$(x-1,y)<>t$ or game$(x-1,y)<>"x") and (game$(x,y-1)<>t$ or game$(x,y-1)<>"x") then
LET blocked=1
END IF
ELSE
IF (game$(x-1,y)<>t$ or game$(x-1,y)<>"x") and (game$(x,y-1)<>t$ or game$(x,y-1)<>"x") and (game$(x,y+1)<>t$ or game$(x,y+1)<>"x") then
LET blocked=1
END IF
END IF
IF y=1 then
IF x=1 then
IF (game$(x,y+1)<>t$ or game$(x,y+1)<>"x") and (game$(x+1,y)<>t$ or game$(x+1,y)<>"x") then
LET blocked=1
END IF
ELSEIF x=sxmax then
IF (game$(x,y+1)<>t$ or game$(x,y+1)<>"x") and (game$(x-1,y)<>t$ or game$(x-1,y)<>"x") then
LET blocked=1
END IF
ELSE
IF (game$(x,y+1)<>t$ or game$(x,y+1)<>"x") and (game$(x-1,y)<>t$ or game$(x-1,y)<>"x") and (game$(x+1,y)<>t$ or game$(x+1,y)<>"x") then
LET blocked=1
END IF
END IF
ELSEIF y=symax then
IF x=1 then
IF (game$(x,y-1)<>t$ or game$(x,y-1)<>"x") and (game$(x+1,y)<>t$ or game$(x+1,y)<>"x") then
LET blocked=1
END IF
ELSEIF x=sxmax then
IF (game$(x,y-1)<>t$ or game$(x,y-1)<>"x") and (game$(x-1,y)<>t$ or game$(x-1,y)<>"x") then
LET blocked=1
END IF
ELSE
IF (game$(x,y-1)<>t$ or game$(x,y-1)<>"x") and (game$(x-1,y)<>t$ or game$(x-1,y)<>"x") and (game$(x+1,y)<>t$ or game$(x+1,y)<>"x") then
LET blocked=1
END IF
END IF
END IF
ELSE
IF (game$(x,y+1)<>t$ or game$(x,y+1)<>"x") and (game$(x,y-1)<>t$ or game$(x,y-1)<>"x") and (game$(x-1,y)<>t$ or game$(x-1,y)<>"x") and (game$(x+1,y)<>t$ or game$(x+1,y)<>"x") then
LET blocked=1
END IF
END IF
END IF

IF blocked<>1 then
LET game$(x,y)=str$(player+1)
LET clicks=clicks+1
END IF
LET found=1
END IF
LOOP until y=symax or found=1
LOOP until x=sxmax or found=1

LET valid=1
END IF
WINDOW #3
CLEAR
PRINT "move " ;str$(clicks); "/" ;str$(turns)
ELSE
LET valid=1
END IF
LOOP until valid=1
LOOP until done=1
LOOP until done=1 and fin=1
END