Enjoy programming more!
Kidspod is a post site which supports young programmers.
First step to join us.
Register as a member
For members

2018/09/25 21:19:15

MixJuice GET URL : kidspod.club/mj/582

迷路(BASIC 0.9.9~)

詳細は イチゴジャム レシピ で公開しています。
「プログラムをみる」を参照して下さい。

SOURCE CODE

CLS:'

NEW

10 'Maze
20 CLS:LET Y,0:LET X,0
30 LC 0,Y:? CHR$(1);
40 LC 30,Y:? CHR$(1);
50 LET Y,Y+1:IF Y<>23 GOTO 30
60 LC X,0:? CHR$(1);
70 LC X,22:? CHR$(1);
80 LET X,X+1:IF X<>30 GOTO 60
90 LET X,2
100 LET Y,2
110 LC X,Y:? CHR$(1);
120 LET K,RND(4)
130 IF K==1 LC X-1,Y:GOTO 170
140 IF K==2 LC X,Y+1:GOTO 170
150 IF K==3 LC X+1,Y:GOTO 170
160 LC X,Y-1
170 ? CHR$(1);
180 LET Y,Y+2:IF Y<=20 GOTO 110
190 LET X,X+2:IF X<=28 GOTO 100
200 LET X,1:LET Y,1
210 LET A,1:LET B,1
220 LC 29,21:? CHR$(2);
230 LC X,Y:? CHR$(249);
240 IF (X==29)*(Y==21) END
250 LET I,INKEY()
260 IF I==28 LET X,X-1
270 IF I==29 LET X,X+1
280 IF I==30 LET Y,Y-1
290 IF I==31 LET Y,Y+1
300 IF (A==X)*(B==Y) GOTO 250
310 IF SCR(X,Y)<>1 GOTO 330
320 LET X,A:LET Y,B:GOTO 250
330 LC A,B:? " ";
340 LET A,X:LET B,Y:GOTO 230

'OK

COMMENT