首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Redim'd array error in commodore 64 basic?

Redim'd array error in commodore 64 basic?
EN

Stack Overflow用户
提问于 2014-03-24 10:46:26
回答 3查看 496关注 0票数 1

在我的commodore 64 basic项目中,我得到了一个redim的数组错误

然而,我没有重新调整我的二维数组的尺寸,我也不会多次遍历这行代码!

第1140行出现错误

有人能帮我吗?

谢谢!

代码:

代码语言:javascript
复制
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
EN

回答 3

Stack Overflow用户

发布于 2014-04-02 20:51:43

在子例程之前需要一条end语句。要确保您不会干扰其他任何内容,请执行以下操作:

代码语言:javascript
复制
1099 end

否则,您的程序将“完成”,然后再次运行所有子例程代码,只是为了好玩。

票数 5
EN

Stack Overflow用户

发布于 2014-03-30 06:18:19

这是因为1140行之后的行rem: i to x allows the horizontal aspect of board to be filled with "."s没有任何数字。要解决此问题,您可以删除该行或将数字1145 (例如)放在前面。

票数 0
EN

Stack Overflow用户

发布于 2019-05-30 04:12:38

第200行看起来可疑,因为1510行不存在。

代码语言:javascript
复制
200 if r1 < 50 then gosub 1510
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22600269

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档