Ошибка массива Redim'd в commodore 64 basic?

Я получаю ошибку массива redim'd в моем базовом проекте commodore 64.

Однако я не изменяю размеры своего двумерного массива и не просматриваю строку кода более одного раза!

Ошибка в строке 1140

Может кто-нибудь мне помочь?

Спасибо!

Код:

10 print "start"
20 rem: go to line 1100 in order to fill board with "."s because this is
30 rem: the board's initialization
40 gosub 1100
50 rem: looping from i to x allows for horizontal aspect of board to be printed
60 rem: x represents the width dimension of board, in this case, 8
70 for i = 1 to x
80 rem: looping from j to x allows for vertical aspect of board to be printed
90 rem: x represents the height dimension of board, in this case, 8
100 for j = 1 to x
110 rem: board initialized with "."s is printed
120 print b3$(i,j), 
130 rem: end of first for loop, looping from i to x put on 130; , USED 4 TAB
140 next
150 print
160 rem: end of second for loop, looping from j to x
170 next
180 rem: checks what at the random number is equal to; places word vertically
190 rem: if rand is < 50 and places the word horizontally if rand is > 50
200 if r1 < 50 then gosub 1510
210 if r1 > 50 then print "no"

1000 rem: random num generator generates a random integer
1050 rem: between 0 and 100
1040 rem: values between 0 and 100, inclusive
1050 r1 = int(100*rnd(1))+1


1060 rem: Subroutine Fill 
1070 rem: Purpose: read and data construct which fills b3$(x,x) with
1080 rem: either "."s or other random words depending on whether or not
1090 rem: the subroutine has been run before.
1100 x = 8
1110 rem: x represents the dimension for the board; in this case,8
1120 rem: took out 
1130 rem: array b3 = board = specifications for width and height (8)
1140 dim b3$(x, x)
rem: i to x allows the horizontal aspect of board to be filled with "."s
1150 for i = 0 to x 
1160 rem: j to x allows the vertical aspect of board to be filled with "."s
1170 for j = 0 to x
1180 rem: board filled with dots horizontally and vertically
1190 b3$(i, j) = "."
1200 rem: end of first nested for loop
1210 next
1220 rem: end of second nested for loop
1230 next
1240 return

person Surz    schedule 24.03.2014    source источник


Ответы (3)


Вам нужен оператор end перед вашими подпрограммами. Чтобы убедиться, что вы не мешаете чему-либо еще, что-то вроде:

1099 end

В противном случае ваша программа «завершается», а затем снова выполняет весь код вашей подпрограммы просто для развлечения.

person John C    schedule 02.04.2014

Это потому, что строка rem: i to x allows the horizontal aspect of board to be filled with "."s после строки 1140 не имеет номера. Для решения проблемы можно убрать строку или поставить перед ней число 1145 (например).

person Casimir et Hippolyte    schedule 29.03.2014
comment
это всего лишь комментарий? - person Surz; 30.03.2014

Строка 200 выглядит подозрительно, потому что строки 1510 не существует.

200 if r1 < 50 then gosub 1510
person intrepidis    schedule 29.05.2019