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:51:12

MixJuice GET URL : kidspod.club/mj/588

15 パズル(BASIC 0.9.5~)

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

SOURCE CODE

CLS:'

NEW

10 '15 Puzzle
20 CLS:I=0:S=100
30 I=I+1:[I]=I:IF I<17 GOTO 30
40 GOSUB 200
50 R=RND(4):GOSUB 280
60 IF C GOTO 50
70 T=[P]:[P]=[M]:[M]=T
80 S=S-1:IF S GOTO 40
90 GOSUB 200:?"COUNT ";S:?:I=0
100 I=I+1:IF [I]<>I GOTO 130
110 IF I<17 GOTO 100
120 END
130 R=INKEY():IF R GOTO 130
140 R=INKEY()-28
150 IF(R<0)+(R>3)GOTO 140
160 GOSUB 280
170 IF C GOTO 130
180 T=[P]:[P]=[M]:[M]=T
190 S=S+1:GOTO 90
200 LC 0,0:?:I=1
210 IF [I]<16 GOTO 230
220 ?".. ";:P=I:M=I:GOTO 250
230 IF [I]<10 ?" ";
240 ?[I];" ";
250 IF I%4=0 ?
260 IF I<16 LET I,I+1:GOTO 210
270 ?:RETURN
280 C=0:GOTO 290+R*20
290 IF M%4=1 LET C,1:RETURN
300 M=M-1:RETURN
310 IF M%4=0 LET C,1:RETURN
320 M=M+1:RETURN
330 IF(M-1)/4=0 LET C,1:RETURN
340 M=M-4:RETURN
350 IF(M-1)/4=3 LET C,1:RETURN
360 M=M+4:RETURN

'OK

COMMENT