repeatループが閉じられていませんって出るのはなぜですか?
#define bsize 16 ;ブロックサイズ(正方形)
#define bx 39 ;迷路のサイズ(マス目単位)
#define by 39
#define winx1 bx * bsize ;ウィンドウサイズ
#define winy1 by * bsize
dim maze, bx, by ;迷路データ 0:道、1:壁
dim ptx, 10 : dim pty, 10 ;アイテム用
randomize
screen 0, winx1 + 150, winy1 ;メインウィンドウ
title "迷路・ゲーム"
font "MS Pゴシック", 18, 3
tokuten = 0 ;得点初期化
*start
color 200, 200, 255 : boxf ;ウィンドウ消去
color 50, 50, 255
pos winx1 + 15, 5 : mes "迷路・ゲーム" ;タイトル表示
gosub *tokuten_disp ;得点表示
gosub *maze_make ;迷路作成
;アイテム座標決定
foreach ptx
p = cnt
repeat
ptx(p) = rnd(bx) ;乱数で座標決定
pty(p) = rnd(by)
if maze(ptx(p), pty(p)) = 0 : break ;道ならOK
loop
loop
ptx(0) = bx - 2 : pty(0) = by - 2 ;ゴールにアイテム配置
;アイテム表示
foreach ptx
color 0, 255, 0
boxf ptx(cnt) * bsize + 1, pty(cnt) * bsize + 1, ptx(cnt) * bsize + bsize - 1, pty(cnt) * bsize + bsize - 1
loop
px = 1 : py = 1 ;スタート座標
px1 = 1 : py1 = 1 ;足跡格納用
;ゲームメイン
tt1 = gettime(4) * 3600 + gettime(5) * 60 + gettime(6) ;開始時間
repeat
;足跡消去
color 255, 255, 255
boxf px1 * bsize + 1, py1 * bsize + 1, px1 * bsize + bsize - 1, py1 * bsize + bsize - 1
;キー入力
stick kk, 15
if kk = 1 & maze(px - 1, py) = 0 : px-- ;左(西)
if kk = 2 & maze(px, py - 1) = 0 : py-- ;上(北)
if kk = 4 & maze(px + 1, py) = 0 : px++ ;右(東)
if kk = 8 & maze(px, py + 1) = 0 : py++ ;下(南)
if kk = 128 : end ;[Esc]
;アイテムチェック
foreach ptx
if ptx(cnt) = px & pty(cnt) = py { ;座標チェック
tokuten += 100 ;得点加算
gosub *tokuten_disp ;得点表示
ptx(cnt) = 0 : pty(cnt) = 0 ;アイテム座標消去
break
}
loop
;プレイヤー表示
color 255, 0, 0
circle px * bsize + 1, py * bsize + 1, px * bsize + bsize, py * bsize + bsize
px1 = px : py1 = py ;一つ前
if px = bx - 2 & py = by - 2 { ;ゴール確認
wa = 0 ;合計用
foreach ptx
wa += ptx(cnt) ;x座標の合計
loop
if wa = 0 : break ;ゴールOK
}
;迷路作成(棒倒し法) -----
*maze_make
;迷路初期化
repeat bx
xx = cnt
repeat by
maze(xx, cnt) = 0
loop
loop
;外枠作成
repeat bx ;上下枠
maze(cnt, 0) = 1
maze(cnt, by - 1) = 1
loop
repeat by ;左右枠
maze(0, cnt) = 1
maze(bx - 1, cnt) = 1
loop
;基準点作成
repeat bx / 2
xx = cnt * 2 ;xx = 0, 2, 4, 6, 8, …, 74, 76, 78
repeat by / 2
maze(xx, cnt * 2) = 1 ;cnt*2 = 0, 2, 4, 6, 8, … , 44, 46, 48
loop
loop
;基準1列目の壁作成
xx = 2
repeat by / 2 - 1, 1
yy = cnt * 2 ;yy = 2, 4, 6, 8, … , 44, 46, 48
repeat
rr = rnd(4) ;0-3の乱数発生
if rr = 0 & maze(xx, yy - 1) = 0 { ;上
maze(xx, yy - 1) = 1
break
}
if rr = 1 & maze(xx, yy + 1) = 0 { ;下
maze(xx, yy + 1) = 1
break
}
if rr = 2 & maze(xx - 1, yy) = 0 { ;左
maze(xx - 1, yy) = 1
break
}
if rr = 3 & maze(xx + 1, yy) = 0 { ;右
maze(xx + 1, yy) = 1
break
}
loop
loop
;基準2列目以降の壁作成
repeat bx / 2 - 2, 2
xx = cnt * 2 ;xx = 4, 6, 8, …, 74, 76, 78
repeat by / 2 - 1, 1
yy = cnt * 2 ;yy = 2, 4, 6, 8, … , 44, 46, 48
repeat
rr = rnd(50) \ 4 ;0-3の乱数発生
if rr = 0 & maze(xx, yy - 1) = 0 { ;上
maze(xx, yy - 1) = 1
break
}
if rr = 1 & maze(xx, yy + 1) = 0 { ;下
maze(xx, yy + 1) = 1
break
}
if rr = 3 & maze(xx + 1, yy) = 0 { ;右
maze(xx + 1, yy) = 1
break
}
loop
loop
loop
;迷路描画
color 0, 0, 255
repeat bx
cnt1 = cnt
repeat by
if maze(cnt1, cnt) = 1 {
boxf cnt1 * bsize, cnt * bsize, cnt1 * bsize + bsize, cnt * bsize + bsize
}
loop
loop
return