jsbasic/samples/sample.puzzler.txt

86 lines
4.1 KiB
Plaintext
Raw Normal View History

2012-02-09 03:13:44 +00:00
0 PR#0
10 DIM PP(16),NU(16)
20 POKE - 16368,0
30 TEXT : HOME : VTAB 4: HTAB 14: PRINT "THE PUZZLER"
40 VTAB 15: HTAB 12: PRINT "BY GREGG BUNTIN"
50 FOR I = 1 TO 2000: NEXT I
60 VTAB 20: PRINT "DO YOU WISH INSTRUCTIONS ";: INPUT I$
70 IF I$ < > "Y" THEN 190
80 HOME : VTAB 2: HTAB 14: PRINT "THE PUZZLER"
90 VTAB 4: PRINT "THE OBJECT OF THIS GAME IS TO GET ALL OF": PRINT "THE NUMBERS IN ORDER FROM 1 TO 15"
100 PRINT "THE COMMANDS ARE" SPC( 13);: INVERSE : PRINT "A": NORMAL : HTAB 30: PRINT ":": HTAB 30: PRINT ":"
110 HTAB 25: INVERSE : PRINT "<-";: NORMAL : PRINT " - ";: INVERSE : PRINT "->": NORMAL
120 : HTAB 30: PRINT ":": HTAB 30: PRINT ":": INVERSE : HTAB 30: PRINT "Z": NORMAL
130 PRINT : PRINT "BY MEANS OF THESE COMMANDS YOU WILL ": PRINT "EXCHANGE THE BLANK SPACE WITH THE NUMBER";: PRINT "IN THE UP,DOWN,LEFT OR RIGHT POSITIONS"
150 : VTAB 21: PRINT SPC( 8)"PRESS <ESC> TO START GAME"
160 K = PEEK ( - 16384): IF K < 127 THEN 160
170 IF K = 155 THEN 190
180 GOTO 160
190 POKE - 16368,0: HOME : VTAB 4: HTAB 14: PRINT "THE PUZZLER": VTAB 12
200 PRINT "Type N to start a (N)EW GAME"
220 K = PEEK ( - 16384): IF K < 127 THEN 220
230 IF K = 206 THEN 260
240 IF K = 211 THEN 740
250 GOTO 220
260 HOME : PRINT "SCRAMBLING PUZZLE.............."
261 FOR I = 1 TO 16
270 Q = INT ( RND (1) * 16) + 1
280 IF PP(Q) THEN 270
290 PP(Q) = 1:NU(I) = Q: NEXT
300 TEXT : HOME : GR : COLOR= 12
310 FOR I = 0 TO 19: HLIN 0 + I,39 - I AT I: HLIN 0 + I,39 - I AT 39 - I
320 VLIN 0 + I,39 - I AT I: VLIN 0 + I,39 - I AT 39 - I: NEXT
330 COLOR= 1: FOR I = 9 TO 29 STEP 10: HLIN 0,39 AT I: VLIN 0,39 AT I: NEXT
340 COLOR= 0: HLIN 0,39 AT 39: VLIN 0,39 AT 39
350 FOR I = 1 TO 16:FLAG = 1:PL = I: GOSUB 370
360 NEXT I: GOTO 520
370 IF PL = 1 OR PL = 5 OR PL = 9 OR PL = 13 THEN X = 1
380 IF NU(PL) = 16 THEN RETURN
390 IF PL = 2 OR PL = 6 OR PL = 10 OR PL = 14 THEN X = 11
400 IF PL = 3 OR PL = 7 OR PL = 11 OR PL = 15 THEN X = 21
410 IF PL = 4 OR PL = 8 OR PL = 12 OR PL = 16 THEN X = 31
420 IF PL < 5 THEN Y = 2
430 IF PL > 4 AND PL < 9 THEN Y = 12
440 IF PL > 8 AND PL < 13 THEN Y = 22
450 IF PL > 12 THEN Y = 32
460 COLOR= 12: IF FLAG = 1 THEN COLOR= 2:FLAG = 0
470 IF NU(PL) > 9 THEN 500
480 X = X + 2
490 ON NU(PL) GOTO 850,860,870,880,890,900,910,920,930,1100,1110
500 GOSUB 850:X = X + 4
510 ON NU(PL) - 9 GOTO 840,850,860,870,880,890
520 FOR I = 1 TO 16: IF NU(I) = 16 THEN PL = I: GOTO 540
530 NEXT
540 K = PEEK ( - 16384): IF K < 127 THEN 540
545 POKE - 16368,0
550 IF K = 193 THEN 630
560 IF K = 218 THEN 650
570 IF K = 136 THEN 670
580 IF K = 149 THEN 690
610 IF K = 155 THEN TEXT : HOME : PRINT "BYE-BYE": END
620 GOTO 540
630 IF PL < 5 THEN 520
640 A = - 4: GOTO 710
650 IF PL > 12 THEN 520
660 A = 4: GOTO 710
670 IF PL = 1 OR PL = 5 OR PL = 9 OR PL = 13 THEN 520
680 A = - 1: GOTO 710
690 IF PL = 4 OR PL = 8 OR PL = 12 OR PL = 16 THEN 520
700 A = 1: GOTO 710
710 T = PL:PL = PL + A:FLAG = 0: GOSUB 370
720 NU(T) = NU(PL):NU(PL) = 16:PL = PL - A
730 FLAG = 1: GOSUB 370: GOTO 520
830 END
840 VLIN Y,Y + 5 AT X: VLIN Y,Y + 5 AT X + 2: PLOT X + 1,Y: PLOT X + 1,Y + 5: RETURN
850 VLIN Y,Y + 5 AT X + 1: PLOT X,Y: HLIN X,X + 2 AT Y + 5: RETURN
860 HLIN X,X + 2 AT Y: VLIN Y,Y + 2 AT X + 2: PLOT X + 1,Y + 2: VLIN Y + 3,Y + 5 AT X: HLIN X,X + 2 AT Y + 5: RETURN
870 HLIN X,X + 2 AT Y: HLIN X + 1,X + 2 AT Y + 2: HLIN X,X + 2 AT Y + 5: VLIN Y,Y + 5 AT X + 2: RETURN
880 VLIN Y,Y + 5 AT X + 2: VLIN Y,Y + 2 AT X: PLOT X + 1,Y + 2: RETURN
890 HLIN X,X + 2 AT Y: VLIN Y,Y + 2 AT X: PLOT X + 1,Y + 2: VLIN Y + 3,Y + 4 AT X + 2: HLIN X,X + 1 AT Y + 5: RETURN
900 VLIN Y + 1,Y + 5 AT X: HLIN X + 1,X + 2 AT Y: VLIN Y + 2,Y + 5 AT X + 2: HLIN X,X + 2 AT Y + 2: HLIN X,X + 2 AT Y + 5: RETURN
910 HLIN X,X + 2 AT Y: VLIN Y,Y + 5 AT X + 2: RETURN
920 VLIN Y,Y + 5 AT X: VLIN Y,Y + 5 AT X + 2: PLOT X + 1,Y: PLOT X + 1,Y + 2: PLOT X + 1,Y + 5: RETURN
930 HLIN X,X + 2 AT Y: VLIN Y + 1,Y + 5 AT X + 2: HLIN X,X + 2 AT Y + 2: VLIN Y,Y + 2 AT X: HLIN X,X + 1 AT Y + 5: RETURN