Several sample fixes/improvements by Alan Ratliff

**In "Simple Pong" I eliminated the problem of the bouncing ball erasing the bottom wall of the field, created a means of scoring points (when the ball gets past a paddle and hits the "back wall", the other player scores a point -- one point each time the ball gets past the paddle, so that multiple impacts that typically occur don't count a point each), and allowed the possibility of equiangular bouncing off the paddles, instead of always just bouncing straight back along the same trajectory.

Also, this game isn't really suited for "paddle"-type control on this platform, as there is typically just one mouse for that purpose, not practical for two players. However, with key-control, the comments cited a problem of needing to be able to handle multiple keystrokes. As it was, when one player pressed a directional key, their paddle would start moving and not stop until it hit its upper/lower limit. It would stop, though, if a non-operational key were pressed, or one of the other player's keys. This latter meant that one player hitting a key to move their paddle would stop the other player's paddle from moving, which was where the real problem occurred. Underlying this was the fact all movement was controlled by the single last key pressed. I changed it by introducing variables to control the movement of each paddle which would be set by the appropriate keystrokes. I also added a specific key for each player to stop their paddle's motion, as well as duplicate directional keys so that each player's key group would be suitable for either the left or right hand: with either hand they could press "down" with the index finger, "stop" with the middle finger, and "up" with the fourth finger.

***With "Hangman", I did the usual random-seeding, avoided the initial-keystroke-termination problem, and simplified the word-choosing algorithm, and set it to go through all words in a difficulty-group, then continue by choosing among the 9 words in that group least-recently used. I also incorporated level-change options in the new-game menu, and I greatly reduced the code for the circle-drawing routine (while still utilizing principles of geometry), and re-organized the parts-drawing routines so the "smiley face" routine could be simplified.

***Next is the "Door Detector" game program. Its problems were subtle ones, principally that it would occasionally crash with an "Illegal quantity error in line 320". This concerned the value of "G" that was assigned as COLOR. This crash was quirky, as the program maintained the value of G between 0 and 15 in some places, but not others, while supposedly the value given to COLOR is not "Illegal" unless it's outside the byte-range 0-255; within that range the value merely has its lower nybble isolated to serve as the COLOR value. I put in a tweak to print the value of G to be used in line 320, and upon a crash it was shown as 50. I'm not sure why it occurred this way, but I figured that a way to be safe would be to just *always* ensure that G is kept in the range 0 to 15.

The program also had the "standard" problem that it didn't seed the random-number generator, so it always played an identical "game sequence" every time, instead of different permutaions as you'd normally expect with "random numbers".

Another "subtle" shortcoming I noticed concerned the fact that in successive "rooms" within a game, the "Death Zone" is an incrementally "thick" border region around the room, and in any given room the "exit" could be randomly placed right next to the "Death Zone's" edge, and as the player would start the next room where the previous room's exit was, a next-to-Death-Zone exit would mean the player would start the next room IN the Death Zone (its innermost layer). As it happened, in the one game-sequence that occurred, the final room's exit in the first game was along the Death Zone's edge, but as it was the FINAL room anyway, the next-room starting location was not an issue. I figured, though, that with the game properly randomized, the issue COULD come up, so I now use line 50 (commented in 40) to bump the player out of the Death Zone if they're starting a room within the Zone.

***With "Columns" there was the usual lack of random seeding, and again a rather drab color scheme for the lower number of colors. I also reduced the maximum number of colors by one, so that it would never use both of the indistinguishable grays. Also a comment on line 2840 mentioned a "Future animated splash screen", so I created one.

***The primary problem with "Chase" was lack of random seeding, so it always played the same sequence of games, which would wear out quickly. There were also a few duplicate line numbers I eliminated. The game presentation could also be improved by simply VTABbing up to display each new board layout over the old one, rather than scrolling up for new diagrams. Also, I documented in the instructions how a player should expect to encounter impossible situations frequently, and just move on when that happens; and I generally streamlined the code considerably, including cleaning up messy text displays.

***With "Gaussian distribution 2D", trying an example resulted in an "Illegal quantity in line 160". This was caused by the hires X coordinate just exceeding the maximum 279, apparently due to imprecise calculations. Reducing the designated maximum (assigned to 'w') in line 30 to a value of 278 seems to clear this up. I also reduced the maximum Y a bit so the diagram would not butt against the text on screen-line 21. In addition, there were a few (i.e. redundant) explicit expressions of the value of PI, all then multiplied by 2 to obtain 2PI; I replaced these with one derivation of PI/4 via ATN(1), multiplied by 8 to obtain 2PI, and stored it in variable 'p2' (for "PI * 2").

***With "Original Series Enterprise" I created a much more accurate depiction of said entity. To be honest, it really isn't Gil Keidar's anymore, it's mine...

***Finally, with "Prime Factors", the old version, in a number of cases, did not produce the correct results. I have fixed that problem. I also replaced its series of like multiplications (e.g. 2x2x2x2x2x2) with a base^exponent exprression (2^6).
This commit is contained in:
Joshua Bell 2024-02-19 11:03:15 -08:00
parent 7a42070bcd
commit 6278f871fb
10 changed files with 861 additions and 1092 deletions

View File

@ -76,6 +76,7 @@ sample.dye Will You Dye (Brett Edwards)
sample.pretzel Pretzel (Zee)
sample.3drectangle 3D Rectangle (Tomo Wa)
sample.enterprise Original Series Enterprise (Gil Keidar)
sample.enterprise2 Original Series Enterprise (Alan Ratliff)
sample.colorrings Colored Rings (Miika Oja)
sample.bite Apple Bite (Michael "Moose" O'Malley)

View File

@ -1,7 +1,8 @@
5 PR#3 : TEXT : HOME
6 A = RND(-(PEEK(78) + PEEK(79)*256)) : REM Seed PRNG
10 PRINT "(1) GOSUB/RETURN/POP"
15 PRINT "(2) Basic I/O, IF/THEN"
20 PRINT "(3) Fibbonacci Sequence"
20 PRINT "(3) Fibonacci Sequence"
25 PRINT "(4) Guess my number"
30 PRINT "(5) Guess your number"
35 PRINT "(6) Approximate Pi"
@ -20,7 +21,7 @@
92 PRINT "(19) DOS WRITE/APPEND"
93 PRINT "(20) ONERR ... RESUME"
94 PRINT "(21) CHR$ Tests"
95 PRINT: INPUT "Enter option: "; A : PRINT : HOME : ON A GOTO 100,200,300,400,500,600,700,800,1900,1000,1100,1200,2000,2100,2200,2300,2400,2500,2600,2700,2800
95 PRINT: INPUT "Enter option: "; A : PRINT : HOME : ON A GOTO 100,200,300,400,500,600,700,800,900,1000,1100,1200,2000,2100,2200,2300,2400,2500,2600,2700,2800
98 HOME
99 END
@ -41,7 +42,7 @@
230 IF (NOT A) THEN PRINT "FALSE"
240 PRINT : PRINT "Press any key: " : GET A$ : GOTO 5
300 REM Fibbonacci
300 REM Fibonacci
310 LA = 0 : CU = 1
320 NX = LA + CU : PRINT NX
330 LA = CU : CU = NX
@ -106,7 +107,7 @@
820 PRINT : PRINT "Press any key: " : GET A$ : GOTO 5
900 REM Cellular automata
901 PRINT "Wolfram's CA rules" : PRINT "Try 110, 111, 118, 121, 126" : PRINT
901 PRINT "Wolfram's CA rules" : PRINT "Try 26, 110, 111, 118, 121, 126" : PRINT
902 INPUT "Rule: "; R : PRINT
904 DIM VT(8) : FOR I = 0 TO 7 : VT(I) = NOT( R / 2 = INT( R / 2 ) ) : R = INT(R / 2) : NEXT
910 S$ = " # "
@ -122,13 +123,13 @@
960 GOTO 912
1000 REM Madlibs
1010 INPUT "Name: "; N$
1010 INPUT "Name: "; NM$
1020 INPUT "Verb: "; V$
1030 INPUT "Noun: "; NN$
1040 INPUT "Place: "; P$
1050 S$ = "One day, " + N$ + " " + V$ + " to " + P$ + " to see the " + NN$ + "."
1060 PRINT S$ : PRINT
1070 PRINT : PRINT "Press any key: " : GET A$ : GOTO 5
1030 INPUT "Noun: "; N$
1040 INPUT "Adjective: ";A$
1050 INPUT "Place: "; P$ : PRINT
1060 PRINT "One day, "; NM$; " will "; V$; " to "; P$; " to see the "; A$; " "; N$; "."
1070 PRINT : PRINT : PRINT "Press any key: "; : GET A$ : GOTO 5
1100 REM Lissajous Figures
1105 REM POKE 49168,0 : REM Clear keyboard strobe
@ -152,19 +153,6 @@
1250 VTAB 24 : HTAB 10 : PRINT "Press Any Key To Continue"; : GET A$
1290 GOTO 5
1900 REM Cellular automata
1901 HOME
1902 PRINT "Wolfram's CA rules" : PRINT "Try 110, 111, 118, 121, 126" : PRINT
1903 INPUT "Rule: "; R : PRINT
1904 DIM VT(8) : FOR I = 0 TO 7 : VT(I) = NOT( R / 2 = INT( R / 2 ) ) : R = INT(R / 2) : NEXT
1910 DIM C(30) : DIM N(30) : N(15) = 1
1912 FOR I = 0 TO 30 : C(I) = N(I) : PRINT C(I); : NEXT : PRINT
1916 FOR I = 2 TO 30 - 1
1918 V = 4 * C(I-1) + 2 * C(I) + 1 * C(I+1)
1920 N(I) = VT(V)
1930 NEXT I
1940 GOTO 1912
2000 REM DOS Sequential Text File
2005 PRINT "First, knowing it has 4 lines..." : PRINT
2010 PRINT CHR$(4)"OPEN JABBERWOCKY"
@ -180,16 +168,17 @@
2090 PRINT : PRINT "Press any key to continue: " : GET A$ : GOTO 5
2100 REM Lores Drawing
2110 GR
2110 GR : VTAB 23 : HTAB 15
2112 PRINT "Press a key to return to menu";
2115 OX = -1 : OY = -1
2116 C = 0
2120 X = INT( PDL(0) / 256 * 40 )
2130 Y = INT( PDL(1) / 256 * 48 )
2135 HTAB 1 : VTAB 23 : PRINT X ; " " ; Y ; " "
2140 REM IF ( OX <> X OR OY <> Y ) AND OX <> -1 AND OY <> -1 THEN COLOR= 0 : PLOT OX, OY
2135 HTAB 1 : PRINT X ; TAB(6) ; Y ; TAB(11)
2140 REM IF ( OX <> X OR OY <> Y ) AND OX <> -1 AND OY <> -1 THEN COLOR= 0 : PLOT OX, OY
2150 COLOR= C : PLOT X, Y
2160 OX = X : OY = Y : C = C + 1 : IF C > 15 THEN C = 0
2170 GOTO 2120
2170 ON PEEK(49152) < 128 GOTO 2120 : POKE 49168,0 : GOTO 5
2200 REM Color Chart
2210 GR

View File

@ -1,111 +1,75 @@
100 PRINT "THIS IS THE GAME OF CHASE"
100 PR#0:TEXT:HOME::PRINT "THIS IS THE GAME OF CHASE"
110 PRINT "WANT INSTRUCTIONS";
120 INPUT C$
130 IF LEFT$(C$,1)="N" THEN 230
130 IF LEFT$(C$,1)="N" THEN VTAB 7:GOTO 280
140 IF LEFT$(C$,1)<>"Y" THEN 110
150 PRINT "YOU ARE '*' IN A HIGH VOLTAGE MAZE WITH 5"
160 PRINT "SECURITY MACHINES '+' TRYING TO DESTROY YOU"
170 PRINT "YOU MUST MANEUVER THE SECURITY MACHINES INTO"
180 PRINT "THE MAZE 'X' TO SURVIVE. GOOD LUCK !!!"
190 PRINT "MOVES ARE 7,8,9"
200 PRINT " 4,5,6"
210 PRINT " 1,2,3 0 TO END THE GAME"
220 PRINT
230 DIM A(10,20),E(21),F(21)
240 LET G=0
250 FOR B=1 TO 10
260 FOR C=1 TO 20
270 LET A(B,C)=0
280 IF B=1 THEN 330
290 IF B=10 THEN 330
300 IF C=1 THEN 330
310 IF C=20 THEN 330
320 GOTO 340
330 LET A(B,C)=1
340 NEXT C
350 NEXT B
360 FOR D=1 TO 21
370 LET B=INT(RND(1)*8)+2
380 LET C=INT(RND(1)*18)+2
390 IF A(B,C)<>0 THEN 370
400 LET A(B,C)=1
410 IF D<6 THEN 430
420 GOTO 440
430 LET A(B,C)=2
440 IF D=6 THEN 460
450 GOTO 470
460 LET A(B,C)=3
470 LET E(D)=B
480 LET F(D)=C
490 NEXT D
500 FOR B=1 TO 10
510 FOR C=1 TO 20
520 IF A(B,C)<>0 THEN 550
530 PRINT " ";
540 GOTO 630
550 IF A(B,C)<>1 THEN 580
560 PRINT "X";
570 GOTO 630
580 IF A(B,C)<>2 THEN 610
590 PRINT "+";
600 GOTO 630
610 IF A(B,C)<>3 THEN 630
620 PRINT "*";
150 HOME:PRINT "YOU'RE '*' IN A HIGH VOLTAGE MAZE WITH 5";
160 PRINT "SECURITY MACHINES '+' TRYING TO DESTROY"
170 PRINT "YOU. YOU MUST MANEUVER THE SECURITY"
180 PRINT "MACHINES INTO A MAZE 'X' TO SURVIVE."
190 PRINT:PRINT "YOU WILL OFTEN FIND YOURSELF DROPPED"
200 PRINT "INTO A GENUINELY IMPOSSIBLE SITUATION."
210 PRINT "WHEN THAT HAPPENS, JUST QUIT THAT GAME"
220 PRINT "AND TRY ANOTHER. GOOD LUCK !!!"
280 VTAB 11:HTAB 23:PRINT "MOVES ARE 7,8,9"
290 HTAB 33:PRINT "4,5,6"
300 HTAB 33:PRINT "1,2,3":PRINT
310 HTAB 23:PRINT "0 TO END THE GAME"
320 DIM A(10,20),E(5),F(5)
330 B=RND(-PEEK(79)*999-PEEK(78))
340 LET G=0
350 FOR B=1 TO 10
360 FOR C=1 TO 20
370 LET A(B,C)=B=1 OR B=10 OR C=1 OR C=20
380 NEXT C
390 NEXT B
400 VTAB 20:CALL -958:VTAB 11
410 POKE 33,20:CALL -958:POKE 33,40
420 FOR D=1 TO 21
430 LET B=INT(RND(1)*8)+2
440 LET C=INT(RND(1)*18)+2
450 IF A(B,C) THEN 430
460 LET A(B,C)=(D<7)*3+SGN(D-6)
470 IF D<6 THEN E(D)=B:F(D)=C
480 IF D=6 THEN X=C:Y=B
490 NEXT D: D=0
500 VTAB 10:PRINT
510 FOR B=1 TO 10
520 FOR C=1 TO 20
530 PRINT MID$(" X+*",A(B,C)+1,1);
630 NEXT C
640 PRINT
650 NEXT B
660 LET B=E(6)
670 LET C=F(6)
680 LET A(B,C)=0
690 INPUT Y
700 ON Y+1 GOTO 1040,730,730,730,740,780,740,710,710,710
710 LET B=B-1
720 GOTO 740
730 LET B=B+1
740 ON Y GOTO 750,780,770,750,780,770,750,780,770
750 LET C=C-1
760 GOTO 780
770 LET C=C+1
780 IF A(B,C)=1 THEN 1060
790 IF A(B,C)=2 THEN 1080
800 LET A(B,C)=3
810 LET E(6)=B
820 LET F(6)=C
640 IF B<10 OR D>6 THEN PRINT
650 NEXT B:ON 9-D GOTO 1080,1100
680 PRINT " ?";
690 GET C$: V=VAL(C$): IF C$<>"0" AND NOT V THEN PRINT CHR$(7);:GOTO 690
700 PRINT:ON NOT V GOTO 1040: IF V=5 GOTO 830
710 LET A(Y,X)=0
730 D=INT((6-V)/3)
740 LET Y=Y+D
750 LET X=V-(2-D)*3+1+X
780 ON A(Y,X) GOTO 1060,1080
800 LET A(Y,X)=3
830 FOR D=1 TO 5
840 IF A(E(D),F(D))<>2 THEN 1020
840 IF A(E(D),F(D))<>2 THEN 1030
850 LET A(E(D),F(D))=0
860 IF E(D)>=B THEN 890
870 LET E(D)=E(D)+1
880 GOTO 910
890 IF E(D)=B THEN 910
900 LET E(D)=E(D)-1
910 IF F(D)>=C THEN 940
920 LET F(D)=F(D)+1
930 GOTO 960
940 IF F(D)=C THEN 960
950 LET F(D)=F(D)-1
960 IF A(E(D),F(D))=3 THEN 1080
970 IF A(E(D),F(D))=0 THEN 1000
980 LET G=G+1
990 GOTO 1010
1000 LET A(E(D),F(D))=2
1010 IF G=5 THEN 1100
1020 NEXT D
1030 GOTO 500
1040 PRINT "SORRY TO SEE YOU QUIT"
870 LET E(D)=SGN(Y-E(D))+E(D)
920 LET F(D)=SGN(X-F(D))+F(D)
960 IF A(E(D),F(D))=3 THEN D=7:GOTO 1030
970 IF A(E(D),F(D)) THEN G=G+1:GOTO 1030
980 A(E(D),F(D))=2
1030 NEXT D: D=(G=5)+D: GOTO 500
1040 PRINT "YOU RESIGNED TO YOUR FATE"
1050 GOTO 1110
1060 PRINT "ZAP!!! YOU TOUCHED THE FENCE !!!!!"
1070 GOTO 1110
1080 PRINT "** YOU HAVE BEEN DESTROYED BY A LUCKY COMPUTER **"
1080 PRINT "** YOU HAVE BEEN DESTROYED BY A LUCKY":PRINT "MACHINE **"
1090 GOTO 1110
1100 PRINT "YOU ARE LUCKY **YOU DESTROYED ALL THE ENEMY**"
1100 PRINT "YOU ARE LUCKY":PRINT "**YOU DESTROYED ALL THE ENEMY**"
1110 PRINT "WANT TO PLAY AGAIN";
1120 INPUT C$
1130 IF LEFT$(C$,1)="Y" THEN 240
1140 IF LEFT$(C$,1)<>"N" THEN 1110
1150 PRINT "HOPE YOU DON'T FEEL FENCED IN."
1160 PRINT "TRY AGAIN SOMETIME"
1170 END
1140 IF LEFT$(C$,1)<>"N" THEN 1110
1150 PRINT "HOPE YOU DON'T FEEL FENCED IN."
1160 PRINT "TRY AGAIN SOMET
1130 IF LEFT$(C$,1)="Y" THEN 330
1140 IF LEFT$(C$,1)<>"N" THEN VTAB PEEK(37):PRINT CHR$(7);:GOTO 1110
1150 VTAB 21:CALL -958:PRINT
1160 PRINT "SORRY TO SEE YOU QUIT"
1170 PRINT "HOPE YOU DON'T FEEL FENCED IN."
1180 PRINT "TRY AGAIN SOMETIME";

View File

@ -1,12 +1,12 @@
10 rem Columns for Applesoft BASIC
20 rem Programed by Arthur Allen
20 rem Programmed by Arthur Allen
30 rem Based on Columns by Jay Geertsen
50 def fnsym(i) = int (symbols * rnd(1)) + 1 : def fncolr(i) = asc(mid$("@AFDCMKLEBGIHNJO",i + 1,1)) - 64
60 dim array(40, 42), erase(25)
70 dim shape(2), nshape(3), check(40, 42)
60 dim array(50, 50), erase(25)
70 dim shape(2), nshape(3), check(50, 50)
90 gosub 2830: rem Interactive pre-screen
90 gosub 2840: rem Interactive pre-screen
350 home
360 rem Fill in borders in array
@ -22,14 +22,13 @@
450 next fill
455 if renew then vtab 21 : htab left + int(width/2) + 1 : print "^" : rem print only if replay selected
460 rem Prefill board
465 gosub 4320 : rem blank out part of screen above prefill
470 guess = 1
480 if rows = 0 goto 720 : rem Skip if rows = 0, otherwise loop will still execute once
540 for i = 3 to width + 2
550 for j = height - rows to height
550 for j = height - rows + 1 to height
555 cycle = 0
570 rem Top of while flag loop
@ -38,17 +37,17 @@
585 cycle = cycle + 1
587 if cycle > 10 then guess = guess + 1 : vtab 22 : print "Attempt: "; guess; ", x pos: "; i; " " : i = i - 1 : if i < 3 then i = 3
590 candidate = 1 + int (symbols * rnd(sd))
590 candidate = fnsym(0)
600 rem Proximity checking
610 if array(i - 1, j) = candidate then if array(i - 2, j) = candidate then flag = 1 : rem same symbol horz left
620 if array(i, j - 1) = candidate then if array(i, j - 2) = candidate then flag = 1 : rem same symbol up
630 if array(i - 1, j - 1) = candidate then if array(i - 2, j - 2) = candidate then flag = 1 : rem same symbol diag left & up
640 if array(i - 1, j + 1) = candidate then if array(i - 2, j + 2) = candidate then flag = 1 : rem same symbol diag left & down
660 if flag then goto 570 : rem Back to top of while flag loop
640 if array(i - 1, j + 1) = candidate then if array(i - 2, j + 2) = candidate then flag = 1 : rem same symbol diag left & down
660 if flag goto 570 : rem Back to top of while flag loop
670 array(i, j) = candidate
680 color= candidate
680 color= fncolr(candidate)
690 plot i, j
700 next j
710 next i
@ -56,32 +55,28 @@
720 rem Pick piece for initial Next window
730 rem Pick shape
740 for s = 0 to 2
750 nshape(s) = 1 + int (symbols * rnd(sd))
750 nshape(s) = fnsym(0)
780 next s
790 rem Make turn
800 x = 2 + int(width/2)
810 y = 0
820 rem Copy Next to current shape
800 x = int(width/2) + 2
810 y = 0
820 rem Copy Next to current shape, get new Next
830 for s = 0 to 2
840 shape(s) = nshape(s)
850 next s
890 rem pick next Next
900 for s = 0 to 2
910 nshape(s) = 1 + int (symbols * rnd(sd))
920 color= nshape(s)
930 plot width + 5 , y+s
910 nshape(s) = fnsym(0)
920 color= fncolr(nshape(s))
930 plot width + 5, s
940 next s
1020 t1 = time
1050 bot = 0
1060 drop = 0
1120 rem Check for end of play
1130 rem Check for conflict
1140 if array(x, y) or array(x, y+1) or array(x, y+3) then goto 90 : rem end of game, go to front end
1140 cfl = array(x, y) or array(x, y+1) or array(x, y+2)
1145 if cfl then gosub 3000 : goto 350 : rem end of game, go to front end
1150 rem Make move loop
1160 if drop then t1 = 1
@ -89,87 +84,56 @@
1180 if peek (49152) > 127 then gosub 1320 : rem Process input if input detected
1190 next clock
1200 y1 = y : x1 = x
1200 y1 = y : x1 = x
1210 y = y + 1
1220 cfl = 0
1240 if not bot then gosub 1630 : rem Move piece
1260 if cfl then goto 2060 : rem Add to shape & check for complete three in a row
1240 if not bot then gosub 1670 : rem Move piece
1260 if cfl goto 2060 : rem Add to shape & check for complete three in a row
1270 if not bot then 1150 : rem Back to top of Make move loop, else force to bottom
1280 y = y - 1 : xdr = 1
1290 gosub 1920 : rem Draw shape (erase)
1290 color= 0 : vlin y, y+2 at x : rem Erase shape
1300 y = y + 1 : xdr = 0
1310 goto 1530 : rem Send piece to bottom
1320 rem Process input
1330 a = PEEK (49152)
1330 for s = 0 to 1 : a = PEEK (49152) : s = a > 127 : next
1340 get g$
1350 if g$ = " " then gosub 1960 : return : rem Check for rotate
1360 if g$ = "J" or a = 136 then gosub 1430 : return : rem Check for move left
1370 if g$ = "K" or a = 149 then gosub 1480 : return : rem Check for move right
1380 if g$ = "D" or a = 138 then gosub 1580 : return : rem Force down
1350 if g$ = " " goto 1970 : rem Check for rotate
1360 s = (g$ = "D" or a = 138) * 2 + (g$ = "K" or a = 149) - (g$ = "J" or a = 136)
1370 if s goto 1590 : rem move left/right/down
1390 if g$ = "M" then bot = 1 : return : rem Send piece to bottom
1400 if g$ = "S" then drop = 1 : rem Speed up piece
1410 if g$ = "P" then gosub 2580 : return : rem Pause game
1415 if g$ = "R" then goto 460 : rem restart at prefill
1410 if g$ = "P" goto 2580 : rem Pause game
1415 if g$ = "R" goto 460 : rem restart at prefill
1420 return
1430 rem Check for move left
1440 x1 = x : y1 = y
1450 x = x - 1
1460 gosub 1630 : rem Move piece
1470 return
1480 rem Check for move right
1490 x1 = x : y1 = y
1500 x = x + 1
1510 gosub 1630 : rem Move piece
1520 return
1530 rem Send piece to bottom
1540 y = y + 1
1545 cfl = 0
1550 if array(x, y+2) then cfl = 1 : rem Check for conflict
1560 if cfl then y = y - 1 : gosub 2010 : goto 2060 : rem Draw, then Add to bottom
1570 goto 1530
1580 rem Force piece down
1590 y1 = y : x1 = x
1600 y = y + 1
1610 gosub 1630 : rem Move piece
1620 return
1560 if cfl then y = y - 1 : gosub 2010 : goto 2070 : rem Draw, then Add to bottom
1570 goto 1540
1580 rem shift piece left, right, or down
1590 y1 = y : x1 = x : s = (s<2) * s
1600 x = x + s : y = y + not s
1630 rem move piece
1670 cfl = 0
1680 if array(x, y) or array(x, y+1) or array(x, y+2) then cfl = 1 : rem Check for conflict
1700 if cfl then gosub 1820 : return : rem Return old values
1680 if array(x, y) or array(x, y+1) or array(x, y+2) then cfl = 1 : rem Check for conflict
1700 if cfl then x = x1 : y = y1 : return : rem Return old values
1710 color= 0
1720 vlin y1, y1+2 at x1
1730 for s = 0 to 2
1740 color= shape(s)
1750 plot x, y+s
1760 next s
1770 return
1820 rem Return old values
1880 x = x1
1890 y = y1
1910 return
1920 rem Erase piece
1930 color=0
1940 vlin y, y+2 at x
1950 return
1730 goto 2010
1960 rem Rotate
1970 swap = shape (2)
1980 shape (2) = shape (1)
1990 shape (1) = shape (0)
2000 shape (0) = swap
2010 for s = 0 to 2 : rem Draw shape, called from 1560
2020 color= shape(s)
2010 for s = 0 to 2 : rem Draw shape, called from 1560 & 1730
2020 color= fncolr(shape(s))
2030 plot x, y+s
2040 next s
2050 return
@ -181,7 +145,7 @@
2090 array(x, y + s) = shape(s)
2100 next s
2110 rem While found (contol at line 2340. End of loop at 2560)
2110 rem While found (contol at line 2340. End of loop at 2560)
2120 found = 0
2130 rem Initialize array
@ -194,7 +158,7 @@
2190 rem Start checking for three in a row
2200 for j = 2 to height
2210 for i = 3 to width + 2
2220 if array(i, j) = 0 then goto 2310 : rem Skip dead cells
2220 if not array(i, j) goto 2320 : rem Skip dead cells
2230 rem Check horizontal
2240 if array(i, j) = array(i - 1, j) and array(i, j) = array(i + 1, j) then check(i - 1, j) = 1 : check(i, j) = 1 : check(i + 1, j) =1 : found = 1
@ -202,7 +166,6 @@
2250 rem Check vertical
2260 if array(i, j) = array(i, j - 1) and array(i, j) = array(i, j + 1) then check(i, j - 1) = 1 : check(i, j) = 1 : check(i, j + 1) = 1 : found = 1 : rem vtab 21 : htab 1 : print "2260 found vertical, j+1 = "; j+1; : rem temp code
2270 rem Check diagonal left
2280 if array(i, j) = array(i - 1, j - 1) and array(i, j) = array(i + 1, j + 1) then check(i - 1, j - 1) = 1 : check(i, j) = 1 : check(i + 1, j + 1) = 1 : found = 1
@ -213,10 +176,10 @@
2320 next i
2330 next j
2335 gosub 2740 : rem Count cells to be removed.
2335 gosub 2740 : rem Count cells to be removed.
2357 rem while not found control:
2340 if not found then goto 790 : rem Goto Make turn
2340 if not found goto 800 : rem Goto Make turn
2350 rem Flash cells
2355 rem gosub 2610 : rem Draw parallel field of check cells
@ -229,30 +192,29 @@
2410 next i
2420 next j
2430 for j = 2 to height
2430 for j = 2 to height
2440 for i = 3 to width + 2
2450 if check(i, j) then color= array(i, j) : plot i, j
2450 if check(i, j) then color= fncolr(array(i, j)) : plot i, j
2460 next i
2470 next j
2480 next blink
2490 rem Remove cells from board
2500 for i = 3 to width + 2
2505 offset = 0
2505 offset = 0
2510 for j = height to 0 step -1
2520 if not check(i,j) then array(i, j + offset) = array(i, j) : color= array(i, j): plot i, j + offset
2530 if check(i, j) then offset = offset + 1
2520 if not check(i,j) then array(i, j + offset) = array(i, j) : color= fncolr(array(i, j)): plot i, j + offset
2530 if check(i, j) then offset = offset + 1
2540 next j
2550 next i
2555 if renew then if rows > 0 then if check(left + int(width/2) ,height) then goto 460 : rem end of screen, go to prefill board
2555 if renew then if rows > 0 then if check(left + int(width/2),height) goto 460 : rem end of screen, go to prefill board
2560 goto 2110 : rem To top of while found loop
2570 rem End of Check field subroutine
2580 rem Pause game
2590 if peek (49152) = 141 then get g$ : null = peek (49168) : return
2590 if peek (49152) = 141 then get g$ : return
2600 goto 2580
2740 rem Count deleted cells
@ -262,95 +224,111 @@
2770 if check (i, j) then dead = dead + 1: nowdead = nowdead + 1
2780 next i
2790 next j
2800 vtab 22 : htab 1 : print "Cleared: "; nowdead; " "
2810 vtab 23 : htab 1 : print "Total: "; dead
2800 vtab 22 : htab 1 : print "Cleared: "; nowdead; : call -868
2810 print : print "Total:" spc(3) dead
2820 return
2830 rem Front end screen
2840 rem gosub ? : rem Future animated splash screen
2840 gosub 5000 : rem Show animated splash screen
2860 rem setup default values and screen
2870 rows = 20 : rem Prefill rows
2880 width = 6
2890 symbols = 5
2900 renew = 1 : rem replay value (yes = 1/no = 0)
2905 choice = 21 : rem vtab position of menu choice
2910 time = 500
2920 height = 39 : rem Full GR screen with text window. Cannot be larger than 47
2920 height = 39 : rem Full GR screen with text window. Cannot be larger than 39
2930 left = 2
2935 rem End of game gosubs to here, past splash screen and default values
2940 gr
2950 home
2970 color= 15 : rem Draw white borders
2980 vlin 0, height at left
2990 vlin 0, height at left + width + 1
2995 gosub 4240 : rem draw top line to indicate height.
3000 vtab 21 : print " Replay on cleared cell above ^ ";
3003 if renew then print "YES"
3005 if not renew then print "NO "
3007 if rows = 0 then vtab 21 : htab 36 : print "N/A"
3010 print " Width (3 - 34) "; width; : print " [ENTER] to start"
3020 print " Prefill (0 - 30) "; rows
3030 print " Colors (3 - 14) "; symbols;
3035 vtab choice : htab 1 : print "-->"; : rem draw arrow
3040 rem Combine the random number seed with a loop that polls for input for game options
3050 for sd = 0 to 32767
3060 if peek (49152) > 127 then goto 4000 : rem Process input if input detected
3070 a = rnd (sd * -1) : rem Dummy variable, just used to increment random number
3080 next sd
3090 goto 3050 : REM Return to top of sd to begin poll again
3000 time = 500 : sd=RND(-PEEK(79)*999-PEEK(78))
3005 gosub 4200 : home : print "--> Replay on cleared cell above ^ "; : gosub 4180 : print
3010 htab 5 : print "Width (3 - 34) "; width; tab(24) "[ENTER] to start"
3020 htab 5 : print "Prefill (0 - 30) "; rows
3030 htab 5 : print "Colors (3 - 13) "; symbols;
3040 if cfl then htab 26 : print "[ESC] to exit"; : htab 1
3050 vtab 21 : choice = 21 : rem vtab position of menu choice
4000 rem Process Input
4010 a = PEEK (49152)
4020 get g$
4020 for s = 0 to 1 : a = PEEK (49152) : s = a > 127 : next : get g$
4030 if g$ = "J" or a = 136 then gosub 4120 : rem left option
4040 if g$ = "K" or a = 149 then gosub 4180: rem right option
4050 if g$ = "D" or g$ = "M" or a = 138 then choice = choice + 1: rem down
4060 if g$ = "I" or a = 139 then choice = choice - 1: rem up
4050 i = (g$ = "D" or g$ = "M" or a = 138) - (g$ = "I" or a = 139)
4060 if i then i = choice + i : htab 1 : print spc(3) : choice = ((i = 20) - (i = 25)) * 4 + i : vtab choice : htab 1 : print "-->"; : goto 4020 : rem up/down
4070 if a = 141 then return : rem enter/return to start the game. This is why Process Input is not a subroutine
4075 if cfl and a = 155 then pop : home : print : print "BYE!" : end
4080 a = (g$ = "K" or a = 149) - (g$ = "J" or a = 136)
4090 on not a goto 4020 : on choice - 20 gosub 4130,4140,4150,4160
4092 on not a goto 4020 : vtab choice : htab asc(mid$("dTVU",choice - 20,1)) - 64
4094 if choice > 21 then print i spc(1) : on choice/12 gosub 4200,4250 : if choice = 23 and (rows = a or not rows) then vtab 21 : htab 36 : a=2
4095 if choice = 21 or a = 2 then gosub 4180 : htab 1
4100 vtab choice : goto 4020
4080 if choice < 21 then choice = 24
4090 if choice > 24 then choice = 21
4120 rem Left & Right Choices
4130 renew = 1 - renew: a = rows : return : rem toggle Renew
4140 i = width + a : a = (i > 2 and i < 35) * a : width = width + a : return : rem width
4150 i = rows + a : a = (i >= 0 and i < 31) * a : rows = rows + a : return : rem prefill height
4160 i = symbols + a : a = (i > 2 and i < 14) * a : symbols = symbols + a : return : rem colors
4110 goto 2940 : rem redraw screen
4180 print mid$("N/ANO YES",(rows > 0) * (renew + 1) * 3 + 1,3); : return
4120 rem Left Choice
4130 if choice = 21 then renew = 1 + renew * (-1): rem toggle Renew
4140 if choice = 22 then if width > 3 then width = width - 1: rem width
4150 if choice = 23 then if rows > 0 then rows = rows - 1 : rem prefill height
4160 if choice = 24 then if symbols > 3 then symbols = symbols - 1 : rem colors
4170 return
4180 rem Right Choice
4190 if choice = 21 then renew = 1 + renew * (-1): rem toggle Renew
4200 if choice = 22 then if width < 34 then width = width + 1: rem width
4210 if choice = 23 then if rows < 30 then rows = rows + 1 : rem prefill height
4220 if choice = 24 then if symbols < 14 then symbols = symbols + 1 : rem colors
4230 return
4200 gr : color= 15 : rem Draw white borders
4210 vlin 0, height at left
4220 vlin 0, height at left + width + 1
4240 rem Draw top line to indicate prefill height.
4250 if rows = 0 then return
4260 for i = 3 to width + 2
4270 candidate = 1 + int (symbols * rnd(sd))
4280 color= candidate
4290 plot i, 39 - rows
4300 next i
4250 if not rows then return
4260 for s = 3 to width + 2
4270 color= fncolr(fnsym(1))
4290 plot s, height - rows + 1
4300 next
4310 return
4320 rem Blank out the part of screen above prefill. Called at start of every screen, and on an "R" press
4320 rem Blank out the part of screen above prefill. Called at start of every screen, and on an "R" press
4330 color = 0 : rem black
4340 for j = left + 1 to width + 2
4350 vlin 0, height - rows - 1 at j
4560 next j
4570 return
4350 vlin 0, height - rows at j
4360 for i = 0 to height - rows : array(j,i) = 0 : next i,j
4370 return
4990 rem Animated splash screen by Alan Ratliff
5000 pr#0 : gr : color= 3 : vlin 1,9 at 2 : plot 3,28 : plot 3,38 : plot 4,0 : plot 4,10 : plot 5, 29 : plot 5,37
5010 vlin 13,37 at 32 : vlin 16,34 at 26 : vlin 11,24 at 16 : vlin 14,27 at 11
5020 home : color= 1 : vlin 29,37 at 7 : plot 8,0 : plot 8,10 : plot 9,28 : plot 9, 38 : vlin 1,9 at 10
5030 vlin 14,30 at 36 : vlin 15,36 at 22 : vlin 16,32 at 2 : plot 30,11 : plot 13,25 : vlin 2,8 at 17
5040 color= 11 : vlin 0,10 at 12 : plot 13,38 : plot 14,10 : plot 15, 38
5050 vlin 15,38 at 30 : vlin 13,34 at 20 : vlin 11,24 at 6 : plot 26,13
5060 color= 9 : vlin 28,37 at 17 : plot 18,10 : plot 19,38 : vlin 0,9 at 20
5070 vlin 17,33 at 34 : vlin 12,37 at 24 : vlin 8,23 at 9 : plot 12,36
5080 color= 13 : vlin 0,10 at 22 : vlin 30,31 at 23 : vlin 4,6 at 24 : vlin 30,31 at 25 : vlin 0,10 at 26
5090 vlin 17,36 at 14 : vlin 14,35 at 4 : plot 34,12 : vlin 2,9 at 7
5100 color= 4 : vlin 0,10 at 28 : vlin 30,31 at 29 : vlin 4,6 at 30 : vlin 35,36 at 31 : vlin 0,10 at 32
5110 vlin 14,30 at 18 : plot 37,2 : plot 37,8 : plot 34,36 : plot 26,38 : plot 2,12 : plot 2,36 : vlin 30,37 at 10 : vlin 1,8 at 5
5120 color= 6 : vlin 1,4 at 34 : plot 34,9 : plot 35,28 : plot 35,33 : plot 35,38 : plot 36,0 : plot 36,5 : plot 36,10 : plot 37,29 : vlin 34,37 at 37
5130 vlin 14,37 at 28 : vlin 21,31 at 8 : plot 19,4 : plot 13,13 : vlin 1,8 at 15 : vlin 27,33 at 12
5140 for i = 1 to 2000 : next i : a = 21 ^ not a : for a = a to (a > 1) * 37 + 14 : for s = 2 to 18 step 2
5150 for i = 0 to 1 : k = a - (s + i + 18) * (a > 20) : k = (k > 0 and k < 15) * k : on not k goto 5400 : y = 39 - s * 2
5160 for j = 0 to y step y : x = sgn(1-j) * i + s + j : y = x / 2 : y = int(y) = y : k = abs(k) : if y then k = -k
5170 h = sgn(k) : y = 28 - y * 18 - k : for y = y to h * 10 + y step h : color= scrn(x,y+h) : plot x,y : next
5180 color= 0 : hlin x,x - h at y : next
5400 next i,s,a : a = 1.5 : for x = 34 to 37 : color= (a<2) * 8 + a : a = a * 2 : y = x * 2
5410 hlin 39 - x,x at 79 - y : hlin 39 - x,x at y - 41 : next
5420 htab 9 : print "Created by JAY GEERTSEN"
5430 for a = 1 to 12000 : next a
5440 print : htab 5 : print "Applesoft coding by ARTHUR ALLEN"
5580 rem Key guide screen
5590 for a = 1 to 48000 : next a : text : home
5600 vtab 3 : print "Keys used:" : print
5610 print "<-- or J to move piece left"
5620 print "--> or K to move piece right"
5630 print "<SPACE> to rotate colors downward"
5640 print " |" spc(4) "M to send piece to bottom"
5650 print " | or D to force piece down"
5660 print "\|/" spc(3) "S to speed up piece"
5670 htab 7 : print "R to restart at prefill level"
5680 htab 7 : print "P to pause game"
5690 vtab 21 : print "Press a key to choose game settings"
5700 print : print "(or <-- or --> to see Splash again) "; : get g$
5710 i = asc(g$) : a = i = 21 : on i = 8 or a goto 5000 : home : return

View File

@ -1,106 +1,98 @@
4 TEXT: HOME
4 PR# 0:TEXT: HOME
5 HTAB 15: INVERSE: PRINT "DOOR DETECTOR": NORMAL
6 PRINT: PRINT: PRINT "DO YOU WANT INSTRUCTIONS? Y/N"
7 GET P$: IF P$="Y" THEN 610
8 IF P$="N" THEN 10
9 PRINT: GOTO 6
8 IF P$<>"N" GOTO 7
10 E=200: R=1: F=0: Q=0
20 A=20: B=20
30 V=INT (RND(1)*39-R): IF V<0+R THEN 30
40 H=INT (RND(1)*39-R): IF H<0+R THEN 40
50 IF R>5 THEN 520
60 GR: HOME: VTAB 21: PRINT "ENERGY:";E: VTAB 21: HTAB 34: PRINT "ROOM #";R
20 A=RND(-PEEK(79)*999-PEEK(78)): A=20: B=20
30 FOR I=1 TO 2: V=H: H=INT (RND(1)*(40-R*2))+R: NEXT
40 REM Line 50: If prior room's exit was next to Death Zone, you'd now be IN Death Zone — step out of it!
50 A=(A<R)-(A>39-R)+A: B=(B<R)-(B>39-R)+B
60 GR: HOME: VTAB 21: PRINT "ENERGY:";E;: HTAB 34: PRINT "ROOM #";R
65 E=E-1
70 COLOR=15: PLOT A,B: Q=13: GOSUB 190
80 Q=0: GET P$
70 COLOR=15: PLOT A,B: Q=13: GOSUB 180
80 Q=0: FOR I=0 TO 128: I=PEEK(49152): NEXT: POKE 49168,0: I=I - 203: I=I-(I>21) * 32
90 HOME
100 VTAB 21: PRINT "ENERGY:";E: VTAB 21: HTAB 34: PRINT "ROOM #";R
110 IF P$="I" THEN COLOR=0: PLOT A,B: COLOR=15: B=B-1: PLOT A,B: E=E-1
120 IF P$="J" THEN COLOR=0: PLOT A,B: COLOR=15: A=A-1: PLOT A,B: E=E-1
130 IF P$="K" THEN COLOR=0: PLOT A,B: COLOR=15: A=A+1: PLOT A,B: E=E-1
140 IF P$="M" THEN COLOR=0: PLOT A,B: COLOR=15: B=B+1: PLOT A,B: E=E-1
150 IF B<0+R THEN GOSUB 300
160 IF A<0+R THEN GOSUB 300
170 IF A>39-R THEN GOSUB 300
180 IF B>39-R THEN GOSUB 300
190 IF A<V AND B<H THEN VTAB 23: HTAB 10: PRINT "YOU ARE IN THE COLD ZONE"
200 IF A>V AND B>H THEN VTAB 23: HTAB 11: PRINT "YOU ARE IN THE HOT ZONE"
210 IF A=V AND B=H THEN HOME: FLASH: VTAB 21: PRINT "YOU FOUND THE EXIT!!!": NORMAL: FOR I=1 TO 700: COLOR=15: PLOT A,B: COLOR=0: PLOT A,B: NEXT I: R=R+1: GOTO 30
215 IF Q=13 THEN RETURN
220 IF E<0 THEN 240
230 GOTO 80
110 IF SGN(I)=I OR I=3 THEN COLOR=0: PLOT A,B: COLOR=15: A=(I=1)+A-NOT I: B=INT(I/3)+B: PLOT A,B: E=E-1
150 IF B<R OR A<R OR A>39-R OR B>39-R THEN GOSUB 300
180 IF (A-V) * (B-H) > 0 THEN VTAB 23: I=A>V: HTAB I+10: PRINT "YOU ARE IN THE " MID$("COLDHOT",I*4 + 1,4) " ZONE"
190 ON A<>V OR B<>H GOTO 220:IF Q=13 THEN POP
200 HOME: FLASH: PRINT "YOU FOUND THE EXIT!!!": NORMAL
210 Q=15:FOR I=1 TO 20: COLOR=Q: PLOT A,B: Q=15-Q: FOR C=1 TO 300: NEXT C,I: R=R+1: ON R/2 GOTO 30,30,520
220 IF Q=13 THEN RETURN
230 IF E>=0 GOTO 80
240 HOME: INVERSE: VTAB 21: PRINT "YOU RAN OUT OF ENERGY": NORMAL
250 F=7: GOSUB 310
260 FOR PAUSE=1 TO 5000: NEXT PAUSE
270 HOME: VTAB 21: PRINT "THE DOOR WAS IN THE RED AREA"
280 COLOR=1: PLOT V,H
290 GOTO 570
300 HOME: INVERSE: VTAB 21: PRINT "YOU HAVE ENTERED THE DEATH ZONE": NORMAL
310 FOR I=1 TO 250
320 COLOR=G
330 PLOT A,B
340 G=G+1: IF G=16 THEN G=0
340 G=G+1: IF G>15 THEN G=0
350 NEXT I
360 FOR C=1 TO 4
370 W=A+1: X=A-1: Y=B+1: Z=B-1
380 PLOT A,B
390 COLOR=0: PLOT A,B
400 FOR D=1 TO 10: COLOR=G
410 IF W>39 THEN W=39
420 IF X<O THEN X=0
430 IF Y>39 THEN Y=39
440 IF Z<0 THEN Z=0
370 W=A: X=A: Y=B: Z=B
380 COLOR=0: PLOT A,B
390 FOR D=1 TO 10: COLOR=G
400 W=(W<39)+W: X=X-(X>0): Y=(Y<39)+Y: Z=Z-(Z>0)
450 PLOT W,B: PLOT X,B: PLOT A,Y: PLOT A,Z
455 FOR PAUSE=1 TO 250: NEXT PAUSE
460 COLOR=0: PLOT W,B: PLOT X,B: PLOT A,Y: PLOT A,Z
465 FOR PAUSE=1 TO 250: NEXT PAUSE
470 W=W+1: X=X-1: Y=Y+1: Z=Z-1
480 G=G+1: NEXT D
470 FOR PAUSE=1 TO 250: NEXT PAUSE
480 G=(G+1) * (G<15): NEXT D
490 NEXT C: IF F=7 THEN RETURN
500 GR: GOTO 260
510 FOR I=1 TO 200: NEXT I
520 TEXT: HOME
530 PRINT "WELL DONE!"
540 PRINT: PRINT "YOU HAVE ESCAPED FROM ALL FIVE ROOMS"
550 PRINT "SUCCESSFULLY, WITH ";E;" UNITS OF"
560 PRINT "ENERGY LEFT.": PRINT
570 PRINT "WANT TO PLAY AGAIN? Y/N"
580 GET A$: IF A$="Y" THEN 10
590 IF A$="N" THEN PRINT: PRINT "SO LONG!": END
600 PRINT: GOTO 570
600 PRINT CHR$(7);: GOTO 580
610 HOME
620 PRINT "The object of this game is to escape"
630 PRINT "from a series of five rooms before you"
640 PRINT "run out of energy."
650 PRINT: PRINT "Each room contains an invisible door"
660 PRINT "you must locate to advance to the"
670 PRINT "next room."
640 PRINT "run out of energy. Each room contains"
650 PRINT "an invisible door you must locate to"
660 PRINT "advance to the next room."
680 PRINT: PRINT "Use the I, J, K and M keys to move"
690 PRINT "around the rooms."
700 PRINT: PRINT "PRESS ANY KEY TO CONTINUE"
710 GET P$: IF P$=" " THEN GOTO 720
720 HOME: PRINT "Each room is divided into different"
730 PRINT "zones:"
740 PRINT: PRINT "All the area ABOVE and to the LEFT of"
750 PRINT "the door is called the COLD ZONE."
760 PRINT: PRINT "All the area BELOW and to the RIGHT of"
770 PRINT "the door is called the HOT ZONE."
780 PRINT: PRINT "When you enter one of these zones, a"
790 PRINT "message on the screen will tell you so."
800 PRINT "Use this information to help you locate each door."
810 PRINT: PRINT "You must also beware of the DEATH ZONE,"
820 PRINT "which surrounds the border of each room.In each room, this zone is a little bit"
830 PRINT "wider than in the previous room."
700 PRINT: PRINT "Each room is made up of different zones:"
710 PRINT "All the area ABOVE and to the LEFT of"
720 PRINT "the door is called the COLD ZONE."
730 PRINT: PRINT "All the area BELOW and to the RIGHT of"
740 PRINT "the door is called the HOT ZONE."
750 PRINT: PRINT "When you enter one of these zones, a"
760 PRINT "message on the screen will tell you so."
770 PRINT "Use this information to help you locate each door."
780 VTAB 24: PRINT "PRESS ANY KEY TO CONTINUE ";
790 GET P$
800 HOME: PRINT "You must also beware of the invisible"
810 PRINT "DEATH ZONE, which surrounds the border"
820 PRINT "of each room. In each room, this zone isa little bit wider than in the previous room."
840 PRINT: PRINT "If you ever enter this zone, the game"
850 PRINT "will end immediately!"
860 PRINT: PRINT "PRESS ANY KEY TO CONTINUE"
870 GET P$: IF P$=" " THEN GOTO 880
880 HOME: PRINT "You have 200 units of energy."
890 PRINT "Every time you move one space, one unit"
900 PRINT "is used up."
910 PRINT: PRINT "If you make it through all five rooms, you win. But if you run out of energy orenter the DEATH ZONE, the game is over."
860 PRINT: PRINT "You have 200 units of energy."
870 PRINT "Every time you move one space, one unit"
880 PRINT "is used up."
890 PRINT: PRINT "If you make it through all five rooms,"
900 PRINT "you win. But if you run out of energy orenter the DEATH ZONE, the game is over."
920 PRINT: PRINT "Good luck!"
930 PRINT: PRINT "PRESS ANY KEY TO START THE GAME"
940 GET P$: IF P$=" " THEN GOTO 10
950 GOTO 10
930 VTAB 23: PRINT "PRESS ANY KEY TO START THE GAME ";
940 GET P$: GOTO 10

View File

@ -0,0 +1,34 @@
5 PR#0:HOME
10 GR
20 COLOR=7
22 HLIN 10,12 AT 17
25 HLIN 8,16 AT 16
30 HLIN 5,17 AT 15
40 HLIN 7,15 AT 14
45 HLIN 10,12 AT 13
50 COLOR=13
60 PLOT 11,12
90 PLOT 11,18
100 COLOR=7
110 HLIN 15,17 AT 17
120 HLIN 16,18 AT 18
130 HLIN 17,27 AT 19
140 HLIN 17,28 AT 20
150 HLIN 17,25 AT 21
160 HLIN 17,22 AT 22
170 COLOR=1
180 PLOT 16,21
190 COLOR=7
200 VLIN 15,18 AT 23
210 VLIN 15,18 AT 24
230 HLIN 20,31 AT 14
240 HLIN 20,32 AT 13
250 COLOR=9
260 VLIN 13,14 AT 20
270 COLOR=5
280 VLIN 15,18 AT 22
290 HLIN 20,21 AT 15
300 HLIN 25,30 AT 15
310 COLOR=1
320 VLIN 14,15 AT 19
330 PRINT "THE ORIGINAL SERIES ENTERPRISE"

View File

@ -1,18 +1,18 @@
90 home
90 text: pr#0: home
95 print "Enter a number to find its factors!"
97 print
100 input a
110 print
120 let f=0
140 if A/2=int(A/2) then let A=A/2: print "2x";: let f=1: goto 140
145 let i=3
150 let e=int(sqr(a)) + 2
155 let f=0
160 for n=i to e step 2
180 if a/n=int(a/n) then print n;"x";: let a=a/n: let i=n: let n=e: let f=1
200 next n
97 print "(Zero to quit.)"
100 print: input a: a=abs(a)
110 print: if not a then print "Bye!";: end
120 s=2: e=1
130 n=0: for i=s to e step 2
150 f=a/i
160 if int(f)=f then let a=f: n=n+1: goto 150
170 if n then print i;: s=i: i=e
180 next
190 if n>1 then print "^"; n;
200 if n and a>1 then print " x ";
210 rem print a;" "; n;" "; i;" "; e;" ";f
220 if a>n and f<>0 then goto 155
230 print a
235 print
240 goto 100
220 s=(s>2)+s+1: n=(s>3)*2+not n
230 if n<3 and a>1 then e=sqr(a): goto 130
240 if n=1 or a>1 then print a;
250 print: goto 100

View File

@ -1,47 +1,47 @@
5 rem Plot Gaussian distribution in two dimensions
10 text: home: PRINT "Std. Dev. = ";: input s1
20 hgr: hcolor = 3
30 w = 279: h = 159
40 w0 = w - 100: w1 = w0/10
45 h1 = h - 100: h2 = h - 60
50 k = 0.5: m = 1 / (2 * 3.14159265 * s1 * s1)
60 for i = 0 to 10 step k
70 x = 10 * i + 1: y = 10 * i + h1
75 hplot x,y
80 for j = 0 to w0 step 1
85 j1 = 10 * j / w0
90 d1 = abs(5 - i)
100 d2 = abs(5 - j1)
110 r2 = (d1*d1+d2*d2)/(2*s1*s1)
120 g = exp(-r2)/(2*3.14159*s1*s1)
130 a = int((h2 * g)/ m)
140 x = 10 * i + w1 * j1 + 1
150 y = 10 * i + h1 - a
160 hplot to x,y
170 if (i = 0) goto 265
175 if (j = w0) goto 190
180 j2 = int(j/10): if ((j/10) <> j2) goto 290
190 d1 = abs(5 - i + k)
200 d2 = abs(5 - j1)
210 r2 = (d1*d1+d2*d2)/(2*s1*s1)
220 u = exp(-r2)/(2*3.14159*s1*s1)
225 a1 = int((h2 * u)/ m)
230 x1 = 10 * (i - k) + w1 * j1 + 1
240 y1 = 10 * (i - k) + h1 - a1
245 rem if (y <= y1) goto 290
250 hplot to x1,y1
260 hplot x,y
265 if (j = 0) goto 310
270 if (i < 10) goto 290
275 if (j = w0) goto 295
280 j2 = int(j/10): if ((j/10) = j2) goto 295
290 hcolor = 0
295 hplot to x,10 * i + h1
300 hcolor = 3
305 hplot x,y
310 next j
320 next i
330 hplot w+1,h: hplot to 100+1,h: hplot to 0+1,h1
340 vtab 21: print "Gaussian (standard deviation = ";s1;")"
350 print "Plot from -5.0 to + 5.0"
360 print "Peak value = "m
5 rem Plot Gaussian distribution in two dimensions
10 text: home: PRINT "Standard Deviation = ";: input s1
20 hgr: hcolor = 3
30 w = 278: h = 155: p2 = atn(1) * 8
40 w0 = w - 100: w1 = w0/10
45 h1 = h - 100: h2 = h - 60
50 k = 0.5: m = 1 / (p2 * s1 * s1)
60 for i = 0 to 10 step k
70 x = 10 * i + 1: y = 10 * i + h1
75 hplot x,y
80 for j = 0 to w0
85 j1 = 10 * j / w0
90 d1 = abs(5 - i)
100 d2 = abs(5 - j1)
110 r2 = (d1*d1+d2*d2)/(2*s1*s1)
120 g = exp(-r2)/(p2*s1*s1)
130 a = int((h2 * g)/ m)
140 x = 10 * i + w1 * j1 + 1
150 y = 10 * i + h1 - a
160 hplot to x,y
170 if not i goto 265
175 if j = w0 goto 190
180 j2 = j/10: if int(j2) <> j2 goto 290
190 d1 = abs(5 - i + k)
200 d2 = abs(5 - j1)
210 r2 = (d1*d1+d2*d2)/(2*s1*s1)
220 u = exp(-r2)/(p2*s1*s1)
225 a1 = int(h2 * u / m)
230 x1 = 10 * (i - k) + w1 * j1 + 1
240 y1 = 10 * (i - k) + h1 - a1
245 rem if y <= y1 goto 290
250 hplot to x1,y1
260 hplot x,y
265 if not j goto 310
270 if i < 10 goto 290
275 if j = w0 goto 295
280 j2 = j/10: if int(j2) = j2 goto 295
290 hcolor = 0
295 hplot to x,10 * i + h1
300 hcolor = 3
305 hplot x,y
310 next j
320 next i
330 hplot w+1,h: hplot to 100+1,h: hplot to 0+1,h1
340 vtab 21: print "Gaussian (std. dev. = ";s1;")"
350 print "Plot from -5.0 to + 5.0"
360 print "Peak value = "m

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +1,42 @@
0 REM
1 REM Newsgroups: comp.sys.apple2
2 REM From: mad.scientist.jr@gmail.com
3 REM Message-ID: <1193160910.224728.270640@z24g2000prh.googlegroups.com>
4 REM Subject: Re: woz' original "brick out" - source code , paddles
5 REM Date: Tue, 23 Oct 2007 17:35:10 -0000
6 REM
10 REM APPLE II SIMPLE PONG V4
20 REM PASTE INTO Joshua Bell s EMULATOR AT inexorabletash.github.io/jsbasic/
20 REM PASTE INTO Joshua Bell's EMULATOR AT inexorabletash.github.io/jsbasic/
25 REM ++++++++++++++++++++++++++++++++++++++++
30 REM TITLE SCREEN + PROMPT FOR CONTROLS
35 REM ++++++++++++++++++++++++++++++++++++++++
40 TEXT : REM ENTER TEXT MODE
45 HOME : REM CLEAR TEXT SCREEN
49 PRINT "APPLE II SIMPLE PONG V4"
40 TEXT : PR#0 : HOME : REM ENTER TEXT MODE, CLEAR SCREEN
45 DEF FN pd(k) = (26 * pdl(k)) / 255 + 2 : REM DEFINE PADDLE-READING FUNCTION
46 REM DEF FN pr(k) = SGN(INT((pdl(k) - 55) / 146)) : REM (non-absolute) paddle function
49 PRINT "APPLE II SIMPLE PONG V4.1"
50 PRINT
51 PRINT "version 1 by aiiadict"
52 PRINT "tweaks by Mad Scientist Jr"
53 PRINT "and Alan Ratliff (2020)"
54 PRINT
55 PRINT "During game press Q to quit."
56 PRINT
58 INPUT "TYPE K FOR KEYS (A/Z, K/M) OR P FOR PADDLES OR Q TO QUIT? ";C$
60 IF C$ <> "K" AND C$ <> "P" AND C$ <> "Q" THEN GOTO 58
62 IF C$ = "Q" THEN GOTO 9000
56 PRINT : HTAB 18 : PRINT "^ # ^" SPC(5) "^ # ^"
58 PRINT "TYPE K FOR KEYS" SPC(2) "A/S/D" SPC(5) "J/K/L" : HTAB 19 : PRINT "Z/X" SPC(7) "M/,"
59 PRINT " (# = STOP)" TAB(19) "v v" SPC(7) "v v" : PRINT : PRINT "OR P FOR PADDLES OR Q TO QUIT? ";
60 GET C$ : IF C$ <> "K" AND C$ <> "P" AND C$ <> "Q" GOTO 60
62 IF C$ = "Q" THEN VTAB 22 : GOTO 9000
65 REM
70 REM ++++++++++++++++++++++++++++++++++++++++
75 REM DRAW FIELD AND INITIALIZE GAME
80 REM ++++++++++++++++++++++++++++++++++++++++
85 GR: REM ENTER GRAPHIC MODE
85 HOME : GR: REM ENTER GRAPHIC MODE
90 COLOR= 7: VLIN 0,39 AT 0: VLIN 0,39 AT 39
95 HLIN 0,39 AT 0: HLIN 0,39 AT 39
100 bx = 10:by = 10:ox = 10:oy = 10: REM BALL START POSITION
102 dx = 1: dy = - 1: REM BALL DIRECTION
104 p1 = 10: o1 = 10: REM PLAYER 1 START POSITION
106 p2 = 10: o2 = 10: REM PLAYER 2 START POSITION
120 PL = 8: REM PADDLE LENGTH
120 v1 = 0 : v2 = 0 : s1 = 0 : s2 = 0 : u1 = 0 : u2 = 0 :
125 PL = 8: REM PADDLE LENGTH
130 REM
145 REM ++++++++++++++++++++++++++++++++++++++++
150 REM BEGIN MAIN GAME LOOP
@ -52,91 +54,62 @@
399 REM ++++++++++++++++++++++++++++++++++++++++
400 REM DRAW AND MOVE BALL
401 REM ++++++++++++++++++++++++++++++++++++++++
402 IF ox <> bx OR oy <> by THEN COLOR= 0: PLOT ox,oy: PLOT ox,oy + 1
410 COLOR= 5: PLOT bx,by: PLOT bx,by + 1
416 ox = bx:oy = by
830 bx = bx + dx
835 IF SCRN( bx,by) > 0 THEN dx = - dx
840 by = by + dy
845 IF SCRN( bx,by) > 0 THEN dy = - dy
402 IF ox <> bx OR oy <> by THEN COLOR= 0: VLIN oy,oy + 1 AT ox
410 COLOR= 11: VLIN by,by + 1 AT bx
420 ox = bx : oy = by : bb = 1
470 bx = bx + dx
490 IF SCRN( bx,by) OR SCRN( bx, by + 1) THEN dx = -dx : k = (bx=3)*p1+(bx=36)*p2 : IF bx*2=39-dx*33 AND ((k>0)*by-PL/2-k+1)*dy > 0 THEN bb = 0
500 IF bx = 7 THEN u1 = 1
510 IF bx = 33 THEN u2 = 1
520 IF bx = 1 AND u1 THEN s2 = s2 + 1 : u1 = 0 : VTAB 22 : HTAB 41 - LEN(STR$(s2)) : PRINT s2;
530 IF bx = 38 AND u2 THEN s1 = s1 + 1 : u2 = 0 : VTAB 22 : HTAB 1 : PRINT s1
540 by = by + dy
840 IF (SCRN( bx,by) OR SCRN( bx, by + 1)) AND bb THEN dy = -dy
850 IF bx < 1 THEN bx = 1
860 IF bx > 38 THEN bx = 38
870 IF by < 1 THEN by = 1
880 IF by > 38 THEN by = 38
881 REM
882 REM ----------------------------------------
883 REM SAVE OLD SCREEN POSITION
884 REM ----------------------------------------
885 o1 = p1
886 o2 = p2
889 REM
880 IF by > 37 THEN by = 37
890 o1 = p1 : o2 = p2
900 REM ++++++++++++++++++++++++++++++++++++++++
901 REM GET PLAYER INPUT
902 REM ++++++++++++++++++++++++++++++++++++++++
903 IF PEEK ( - 16384) > 127 THEN GET K$: REM SEE IF KEY(S) PRESSED. NEEDS FIX FOR MULTI KEY SIMULTANEOUS INPUT
903 IF PEEK ( - 16384) > 127 THEN GET K$: IF K$ = "Q" GOTO 9000 : REM SEE IF KEY PRESSED/Q FOR QUIT
904 IF C$ <> "K" THEN GOTO 921
905 REM
906 REM ----------------------------------------
907 REM KEYBOARD INPUT
908 REM NOTE: NEEDS FIX TO DETECT MULTI KEYPRESSES
909 REM ----------------------------------------
912 IF K$ = "A" THEN p1 = p1 - 1
914 IF K$ = "Z" THEN p1 = p1 + 1
916 IF K$ = "K" THEN p2 = p2 - 1
918 IF K$ = "M" THEN p2 = p2 + 1
920 GOTO 955
912 IF K$ = "A" OR K$ = "D" THEN v1 = -1
913 IF K$ = "S" THEN v1 = 0
914 IF K$ = "Z" OR K$ = "X" THEN v1 = 1
916 IF K$ = "J" OR K$ = "L" THEN v2 = -1
917 IF K$ = "K" THEN v2 = 0
918 IF K$ = "M" OR K$ = "," THEN v2 = 1
920 K$ = "" : p1 = p1 + v1 : p2 = p2 + v2 : GOTO 955
921 IF C$ <> "P" THEN GOTO 947
922 REM
923 REM ----------------------------------------
925 REM PADDLE INPUT
927 REM ----------------------------------------
930 REM simple (non-absolute) paddle input:
931 REM if pdl(0) > 200 then p1 = p1 + 1
932 REM if pdl(0) < 55 then p1 = p1 - 1
933 REM if pdl(1) > 200 then p2 = p2 + 1
934 REM if pdl(1) < 55 then p2 = p2 - 1
943 REM realtime (absolute position) paddle input:
944 GOSUB 3000: REM PLAYER 1
945 GOSUB 4000: REM PLAYER 2
932 REM p1 = FN pr(0) + p1
934 REM p2 = FN pr(1) + p2
940 REM realtime (absolute position) paddle input:
944 p1 = FN pd(0)
945 p2 = FN pd(1)
947 REM
948 REM ----------------------------------------
949 REM SEE IF PLAYER PRESSED Q TO QUIT
950 REM ----------------------------------------
951 IF K$ = "Q" THEN GOTO 9000
954 REM
955 REM ++++++++++++++++++++++++++++++++++++++++
956 REM MAKE SURE PADDLES DONT GO OFF SCREEN
956 REM MAKE SURE PADDLES DON'T GO OFF SCREEN
958 REM ++++++++++++++++++++++++++++++++++++++++
960 IF p1 < 2 THEN p1 = 2
970 IF p1 > 28 THEN p1 = 28
980 IF p2 < 2 THEN p2 = 2
990 IF p2 > 28 THEN p2 = 28
1000 REM
1010 REM ++++++++++++++++++++++++++++++++++++++++
1020 REM CONTINUE GAME LOOP
1030 REM ++++++++++++++++++++++++++++++++++++++++
1040 GOTO 150
3000 REM
3010 REM ++++++++++++++++++++++++++++++++++++++++
3020 REM GET SCREEN POSITION FROM PADDLE 1 INPUT
3030 REM ++++++++++++++++++++++++++++++++++++++++
3040 p1 = 26 * pdl(0)
3050 p1 = p1 / 255
3060 p1 = p1 + 2
3070 RETURN
4000 REM
4010 REM ++++++++++++++++++++++++++++++++++++++++
4020 REM GET SCREEN POSITION FROM PADDLE 2 INPUT
4030 REM ++++++++++++++++++++++++++++++++++++++++
4040 p2 = 26 * pdl(1)
4050 p2 = p2 / 255
4060 p2 = p2 + 2
4070 RETURN
999 GOTO 150
9000 REM
9010 REM ++++++++++++++++++++++++++++++++++++++++
9020 REM QUIT GAME
9030 REM ++++++++++++++++++++++++++++++++++++++++
9040 TEXT : REM HOME
9045 PRINT
9050 PRINT "FINISHED APPLE II SIMPLE PONG V4."
9060 END
9040 TEXT : REM HOME
9045 PRINT
9050 PRINT "FINISHED APPLE II SIMPLE PONG V4.1"