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
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)
800 x = int(width/2) + 2
810 y = 0
820 rem Copy Next to current shape
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
@ -92,84 +87,53 @@
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
@ -216,7 +179,7 @@
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
@ -231,7 +194,7 @@
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
@ -240,19 +203,18 @@
2500 for i = 3 to width + 2
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
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,40 +1,40 @@
5 rem Plot Gaussian distribution in two dimensions
10 text: home: PRINT "Std. Dev. = ";: input s1
10 text: home: PRINT "Standard Deviation = ";: input s1
20 hgr: hcolor = 3
30 w = 279: h = 159
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 / (2 * 3.14159265 * s1 * s1)
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 step 1
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)/(2*3.14159*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 (i = 0) goto 265
175 if (j = w0) goto 190
180 j2 = int(j/10): if ((j/10) <> j2) goto 290
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)/(2*3.14159*s1*s1)
225 a1 = int((h2 * u)/ m)
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
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
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
@ -42,6 +42,6 @@
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;")"
340 vtab 21: print "Gaussian (std. dev. = ";s1;")"
350 print "Plot from -5.0 to + 5.0"
360 print "Peak value = "m

View File

@ -1,18 +1,11 @@
100 REM ***HANGMAN**
120 REM BY MIKE GLEASON, 1986, 2011
130 REM MODIFIED BY ALAN RATLIFF, 2020
140 REM
160 REM ==WELCOME SCREEN==
180 TEXT : HOME :SW = PEEK (33):ES$ = "": GG = 1: SND = 1: DD = 0.040: JY = 0
188 DD = 0.0010 : SND = 0: GOTO 380: REM Hack to work in the JavaScript emulator
200 IF (GG < 1) THEN 380
220 IF (PEEK(103) <> 1) THEN 280
240 IF (PEEK(104) = 64) AND (PEEK(16384) = 0) THEN 380
260 IF (PEEK(104) = 96) AND (PEEK(24576) = 0) THEN 380
280 PRINT "THIS VERSION OF HANGMAN IS TOO BIG"
300 PRINT "TO RUN WITHOUT HELP FROM YOU.":PRINT
320 PRINT "PLEASE TYPE THE FOLLOWING:":PRINT
340 PRINT "NEW":PRINT "POKE 103, 1":PRINT "POKE 104, 64":PRINT "POKE 16384, 0":PRINT "RUN HANGMAN"
360 END
180 TEXT : PR#0 : HOME :SW = PEEK (33):ES$ = "": GG = 1: DD = 0.040: JY = 0
188 DD = 0.0010 : SND = 0: REM Hack to work in the JavaScript emulator
380 VTAB 12:I = SW / 2 - 6: HTAB I: PRINT "_ _ _ _ _ _ _";
400 GOSUB 13800 : REM INIT SOUND
420 D = 1: GOSUB 800: HTAB I + 8: PRINT "M";
@ -23,87 +16,88 @@
520 D = 2: GOSUB 800: HTAB I + 0: FLASH : PRINT "H A N G M A N": NORMAL : PRINT
540 D = 2: GOSUB 800
560 A$ = "(C) 1986, 2011 by Mike Gleason"
580 I = SW / 2 - ( LEN (A$) - 0) / 2
580 I = SW / 2 - LEN (A$) / 2
600 HTAB I: PRINT A$;
620 A$ = "Loading, please wait..."
640 I = SW / 2 - ( LEN (A$) - 3) / 2
660 VTAB 23: HTAB I: PRINT A$;: JY=1
680 GOTO 1100
700 :
720 :
800 REM ==DELAY SUBROUTINE==
820 REM Unfortunately, I don't know of a way to make this delay constant
840 REM across CPU speeds. For example, in an emulator, this code may
860 REM run too fast. You can try changing DD to modulate the speed.
880 IF ( PEEK (49152) > 127) THEN 940: REM SKIP DELAY UPON KEYBOARD INPUT
880 IF PEEK (49152) > 127 THEN 940: REM SKIP DELAY UPON KEYBOARD INPUT
900 D = D - DD: IF D > 0 THEN 880
920 GOTO 980
940 A$ = CHR$ ( PEEK (49152) - 128)
960 IF (JY=1) THEN POKE 49168,0
960 IF JY=1 THEN POKE 49168,0
980 RETURN
1000 :
1020 :
1100 REM ==INITIALIZE PROGRAM==
1120 DIM GZ%(32)
1140 GOSUB 3200: REM SETUP LIMBS
1160 GOSUB 13200: REM LOAD WORDS
1180 GOSUB 2500: REM SETUP SCREEN
1200 PRINT "Shall I be [e]asy, "
1220 PRINT " [m]edium, "
1240 PRINT " or [h]ard on you? ";
1260 POKE 49168,0: REM CLEAR KEYB BUFFER
1260 POKE 49168,0: REM CLEAR KEYBD BUFFER
1280 GOSUB 1800
1300 IF (A$ = "E") THEN EZ = 1: GOTO 1400
1320 IF (A$ = "M") THEN EZ = 2: GOTO 1400
1340 IF (A$ = "H") THEN EZ = 3: GOTO 1400
1300 IF A$ = "E" THEN EZ = 1: GOTO 1400
1320 IF A$ = "M" THEN EZ = 2: GOTO 1400
1340 IF A$ = "H" THEN EZ = 3: GOTO 1400
1360 PRINT : GOTO 1200
1400 REM ==GAME LOOP==
1420 HOME:VTAB 24
1440 CHEET = 0
1460 PRINT : GOSUB 2100
1480 PRINT "Play again? (Yes/No) ";: GOSUB 1800
1500 IF (A$ = "Y") THEN 1400
1520 ES$ = "": GOTO 1620
1470 D = 53909/((EZ=2)*13+EZ*3+28)
1480 PRINT "Play again? (";: GU$ = "Yes/": GOSUB 1750: GU$ = "No": GOSUB 1750
1490 REM WHEN OFFERING NEW GAME, ALLOW PLAYER TO CHANGE DIFFICULTY LEVEL IF DESIRED
1500 FOR I = 1 TO 3: IF I<>EZ THEN PRINT "/";: GU$ = MID$("EasyMediumHard",(I=3)*2+I*4-3,I*2+2): GOSUB 1750
1510 NEXT: PRINT ") ";
1520 GOSUB 1800: A = ASC(A$)*2-107: I = D/A
1530 I = INT(I)=I: IF I THEN EZ = (A>31)+(A=37)+1
1540 IF A$ = "Y" OR I GOTO 1400
1550 ES$ = "": IF A$ <> "N" GOTO 1520
1600 REM ==CLEANUP AND EXIT==
1620 TEXT
1640 IF (ES$ = "") THEN 1720
1640 IF ES$ = "" THEN HOME: PRINT "GOOD BYE.": END
1660 GOSUB 14300: REM RING BELL
1680 PRINT : PRINT "* ERROR: ";ES$;"."
1700 END
1720 HOME
1740 PRINT "GOOD BYE."
1760 END
1740 REM PRINT FIRST CHAR OF STRING GU$ INVERSE, THE REST NORMAL
1750 INVERSE: PRINT LEFT$(GU$,1);: NORMAL: PRINT MID$(GU$,2);: RETURN
1800 REM ==GET 1 UPPERCASE CHAR==
1820 GET A$:A$ = LEFT$ (A$,1)
1840 IF (A$ = CHR$ (1)) THEN CHEET = 1: GOTO 1980
1860 IF (A$ = CHR$ (27)) OR (A$ = CHR$ (3)) THEN 1600
1880 A = ASC (A$)
1900 IF ( ASC ("A") < = A) AND (A < = ASC ("Z")) THEN 2020
1920 IF (A < ASC ("a")) OR (A > ASC ("z")) THEN 1980
1940 A$ = CHR$ (A - ( ASC ("a") - ASC ("A")))
1960 GOTO 2020
1980 GOSUB 14300: REM RING BELL
2000 GOTO 1820
1820 GET A$
1840 IF A$ = CHR$ (1) THEN CHEET = 1
1860 IF A$ = CHR$ (27) OR A$ = CHR$ (3) THEN POP: GOTO 1600
1880 IF A$ > "_" THEN A$ = CHR$(ASC(A$) - 32)
1900 IF A$ < "A" OR A$ > "Z" THEN GOSUB 14300: GOTO 1820: REM RING BELL, TRY AGAIN
2020 RETURN
2040 :
2060 :
2100 REM ==GAME SUBROUTINE==
2120 GOSUB 3600: REM SETUP GRAPHICS
2140 GOSUB 9600: REM CHOOSE A SECRET WORD
2120 GOSUB 9600: REM CHOOSE A SECRET WORD
2130 GOSUB 3600: REM SETUP GRAPHICS
2140 REM R=0:GOTO 7370 - WOULD DISPLAY TABLE OF WORDS AND THEIR DIFFICULTY SCORES
2150 OGUESS$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ": REM FULL ALPHABET AVAILABLE
2160 POKE 49168,0: REM CLEAR KEYB BUFFER
2180 NLIMBS = 0:GAMEOVER = 0
2200 FOR I = 0 TO 30:GZ%(I) = 0: NEXT I
2220 HOME: VTAB 21
2300 REM --GUESS LOOP--
2320 GOSUB 7400: REM DISPLAY STATUS
2340 GOSUB 7700: REM GET A GUESS
2360 GOSUB 8100: REM CHECK GUESS
2380 IF GAMEOVER = 0 THEN 2300
2380 IF NOT GAMEOVER THEN 2300
2400 RETURN
2420 :
2440 :
2500 REM ==SETUP SCREEN==
2520 TEXT : HOME : CB$ = "an" : CA$ = "ANIMAL"
2520 TEXT : CB$ = "an" : CA$ = "ANIMAL"
2525 VTAB 12:HTAB 14: INVERSE : PRINT "H A N G M A N": NORMAL:VTAB 24
2530 FOR I=1 TO 11:PRINT:FOR D=1 TO 90:NEXT D,I:VTAB 5
2540 A$ = "Welcome to HANGMAN!": GOSUB 3000: PRINT : PRINT
2560 PRINT "You have been condemned for execution."
2580 PRINT "To escape this fate, you must guess"
@ -122,414 +116,274 @@
2840 A$ = "Press any key to begin!": GOSUB 3000
2841 POKE 49168,0: REM CLEAR KEYB BUFFER
2842 I=1: REM Initialize random number generator
2845 IF ( PEEK (49152) > 127) THEN 2860
2848 I = I + 1
2850 IF I > 127 THEN 2842
2852 GOTO 2845
2860 GET A$
2863 L=RND(-I)
2850 GET A$
2860 I=RND(-PEEK(79)*999-PEEK(78))
2880 HTAB 1: CALL - 868: REM ERASE STATUS MESSAGE
2900 RETURN
2920 :
2940 :
3000 REM ==PRINT CENTERED==
3020 HTAB (40 / 2 - LEN (A$) / 2)
3020 HTAB 20 - LEN (A$) / 2
3040 PRINT A$;
3060 RETURN
3080 :
3100 :
3200 REM ==SETUP LIMBS==
3220 DIM LIMBS$(11)
3240 LIMBS$(1) = "HEAD"
3260 LIMBS$(2) = "LEFT EYE"
3280 LIMBS$(3) = "RIGHT EYE"
3300 LIMBS$(4) = "NOSE"
3320 LIMBS$(5) = "MOUTH"
3340 LIMBS$(6) = "TORSO"
3360 LIMBS$(7) = "LEFT ARM"
3380 LIMBS$(8) = "RIGHT ARM"
3400 LIMBS$(9) = "LEFT LEG"
3420 LIMBS$(10) = "RIGHT LEG"
3440 LIMBS$(11) = "***HANGMAN***"
3460 RETURN
3480 :
3500 :
3600 REM ==SETUP GRAPHICS==
3620 IF (GG = 0) THEN 3680
3640 HGR : GW=280 : GH=160 : REM THIS IS ALL FOR NOW
3660 GOSUB 3800: REM DRAW GALLOWS
3680 RETURN
3700 :
3720 :
3500 REM ==DRAW SMILEY FACE==
3510 IF NOT GG THEN RETURN
3520 Z=0: HCOLOR=1: GOSUB 3880: REM ERASE GALLOWS
3530 ON NLIMBS<>4 GOSUB 4020: REM ERASE BODY, DRAW HEAD & FACE, AS NECESSARY
3540 HCOLOR=5: HPLOT 138,58 TO 143,62 TO 149,62 TO 154,58: REM DRAW SMILE
3550 RETURN
3600 REM ==SET UP GRAPHICS==
3620 IF NOT GG THEN RETURN
3640 HGR : GW=280 : GH=160 : Z=1 : REM THIS IS ALL FOR NOW
3800 REM ==DRAW GALLOWS==
3820 IF (GG = 0) THEN 3980
3820 IF NOT GG THEN RETURN
3840 HCOLOR=1:FOR I=GH-1 TO 152 STEP -1:HPLOT 0,I TO GW-1,I:NEXT I
3860 HCOLOR=3
3880 FOR I=152 TO 148 STEP -1:HPLOT 70,I TO 210,I:NEXT I
3900 FOR I=80 TO 88:HPLOT I,10 TO I,152:NEXT I
3880 FOR I=152 TO 148 STEP -1:HPLOT 70,I TO 210,I:HCOLOR=Z*3:NEXT I
3900 FOR I=80 TO 88:HPLOT I,10 TO I,147:NEXT I
3920 FOR I=10 TO 18:HPLOT 88,I TO 147,I:NEXT I
3940 FOR I=0 TO 7:HPLOT 80,48+I TO 110+I,18:NEXT I
3960 FOR I=147 TO 145 STEP -1:HPLOT I,18 TO I,30:NEXT I
3960 FOR I=145 TO 147:HPLOT I,18 TO I,29:NEXT I
3980 RETURN
4000 :
4020 :
4100 REM ==DRAW LIMB==
4120 IF (GG = 0) THEN 4180
4140 ON NLIMBS GOSUB 4300, 4500, 4700, 4900, 5100, 5500, 5600, 5700, 5800, 5900
4160 GOTO 4200
4180 VTAB 21: HTAB 1: CALL -868: PRINT "Your ";LIMBS$(NLIMBS);" is now hanging!":
4200 RETURN
4220 :
4240 :
4000 REM ==DRAW BODY PART==
4020 ON (NLIMBS<4 AND NOT Z)+NLIMBS GOTO 4300, 4500, 4700, 4900, 5500, 5400, 5300, 5200, 5100, 5000
4300 REM ==DRAW HEAD==
4320 REM Note: It'd be quicker (and use less code) to just HPLOT out the
4340 REM circle by hand rather than calling my CIRCLE2 subroutine, but
4360 REM then the trigonometry lesson would be wasted.
4380 HCOLOR=2
4400 REM HPLOT 126,30 TO 166,30 TO 166,70 TO 126,70 TO 126,30
4420 RADIUS=20:CX=146:CY=50:FILL=0:GOSUB 6000
4440 RETURN
4460 :
4480 :
4500 REM ==DRAW LEFT EYE==
4370 REM N.B.: LESS CODE USED, REAL GEOMETRY LESSON NOT WASTED - SIN AND COS NOT NEEDED
4380 REM HCOLOR=2: HPLOT 126,30 TO 166,30 TO 166,70 TO 126,70 TO 126,30
4420 RADIUS=20: CX=146: CY=50: FILL=0: HC=2: GOSUB 6000
4430 IF Z THEN RETURN
4500 REM ==DRAW RIGHT EYE==
4510 REM (REMEMBER THAT THEIR RIGHT EYE WE SEE ON THE LEFT)
4520 HCOLOR=6:HPLOT 137,43 TO 140,43
4540 HPLOT 136,44 TO 141,44
4560 HPLOT 137,45 TO 140,45
4580 RETURN
4600 :
4620 :
4700 REM ==DRAW RIGHT EYE==
4580 IF Z THEN RETURN
4700 REM ==DRAW LEFT EYE==
4720 HCOLOR=6:HPLOT 152,43 TO 155,43
4740 HPLOT 151,44 TO 156,44
4760 HPLOT 152,45 TO 155,45
4780 RETURN
4800 :
4820 :
4780 IF Z THEN RETURN
4900 REM ==DRAW NOSE==
4920 HCOLOR=0:
4940 IF (FILL=1) THEN 4980
4960 HCOLOR=3
4920 HCOLOR=(FILL<1)*3
4980 HPLOT 146,48 TO 143,52 TO 146,52
5000 RETURN
5020 :
5040 :
5100 REM ==DRAW MOUTH==
5120 HCOLOR=5: HPLOT 140,60 TO 143,56 TO 149,56 TO 152,60
5140 RETURN
5160 :
5180 :
5200 REM ==DRAW SMILEY MOUTH==
5220 IF GG=0 THEN 5440
5240 HCOLOR=0: HPLOT 140,60 TO 143,56 TO 149,56 TO 152,60
5260 HCOLOR=0
5280 HPLOT 146,70 TO 146,106:HPLOT 146,88 TO 116,58:HPLOT 146,88 TO 176,58
5300 HPLOT 146,106 TO 116,140:HPLOT 146,106 TO 176,140
5320 GOSUB 3880
5340 IF (NLIMBS < 1) THEN GOSUB 4380
5360 IF (NLIMBS < 2) THEN GOSUB 4500
5380 IF (NLIMBS < 3) THEN GOSUB 4700
5400 IF (NLIMBS < 4) THEN GOSUB 4900
5420 HCOLOR=5: HPLOT 138,60 TO 143,64 TO 149,64 TO 154,60
5440 RETURN
5460 :
5480 :
5500 REM ==DRAW TORSO==
5520 HCOLOR=2: HPLOT 146,70 TO 146,106
4990 RETURN
5000 REM ==DRAW LEFT LEG==
5020 HPLOT 146,106 TO 176,140 TO 188,133
5040 RETURN
5100 REM ==DRAW RIGHT LEG==
5120 HPLOT 146,106 TO 116,140 TO 104,133
5140 IF Z THEN RETURN
5200 REM ==DRAW LEFT ARM==
5220 HPLOT 146,88 TO 176,58
5240 IF Z THEN RETURN
5300 REM ==DRAW RIGHT ARM==
5320 HPLOT 146,88 TO 116,58
5340 IF Z THEN RETURN
5400 REM ==DRAW TORSO==
5420 IF Z THEN HCOLOR= 2
5430 HPLOT 146,70 TO 146,106
5440 IF Z THEN RETURN
5500 REM ==DRAW SAD MOUTH==
5520 HCOLOR=5*Z
5530 HPLOT 140,60 TO 143,56 TO 149,56 TO 152,60
5540 RETURN
5560 :
5580 :
5600 REM ==DRAW LEFT ARM==
5620 HPLOT 146,88 TO 116,58
5640 RETURN
5660 :
5680 :
5700 REM ==DRAW RIGHT ARM==
5720 HPLOT 146,88 TO 176,58
5740 RETURN
5760 :
5780 :
5800 REM ==DRAW LEFT LEG==
5820 HPLOT 146,106 TO 116,140
5840 RETURN
5860 :
5880 :
5900 REM ==DRAW RIGHT LEG==
5920 HPLOT 146,106 TO 176,140
5940 RETURN
5960 :
5980 :
6000 REM *** SUBROUTINE: CIRCLE2
6000 REM *** SUBROUTINE: CIRCLE2 (REWRITTEN SIMPLIFIED)
6020 REM * IN: RADIUS
6040 REM * IN: CX (X COORDINATE OF CENTER)
6060 REM * IN: CY (Y COORDINATE OF CENTER)
6080 REM * IN: FILL (0 OR 1)
6100 REM ***
6120 PI = ATN (1) * 4: REM = 3.14159265
6140 I0 = PI / 2:I1 = 0:DI = PI / (RADIUS * 4)
6160 I1 = I1 - 0.1: REM SLOP TO FILL IN LAST LINE
6180 I = I0
6200 IF (I < = I1) THEN 7360
6220 X0 = - 666:X1 = - 666:Y0 = - 666
6300 REM
6320 DX = COS (I) * RADIUS:X = INT (0.5 + CX - DX)
6340 DY = SIN (I) * RADIUS:Y = INT (0.5 + CY - DY)
6400 REM PRINT "X = ";X;", Y = ";Y
6420 IF (X0 = - 666) THEN 6500
6440 IF (Y0 < > Y) THEN 6600
6460 X1 = X
6480 GOTO 7300
6500 REM FIRST POINT IN NEW LINE
6520 X0 = X:X1 = X:Y0 = Y: GOTO 7300
6600 REM END OF LINE
6620 IF X0 < = - 666 THEN 7200
6640 R0X = CX + (CX - X0)
6660 IF R0X < GW THEN 6700
6680 R0X = GW - 1
6700 R1X = CX + (CX - X1)
6720 IF R1X < GW THEN 6760
6740 R1X = GW - 1
6760 IF X0 > = 0 THEN 6800
6780 X0 = 0
6800 IF X1 > = 0 THEN 6840
6820 X1 = 0
6840 Y2 = CY + (CY - Y0)
6900 REM DRAW THE LINE(S)
6920 REM PRINT "HPLOT ";X0;",";Y0;" TO ";R0X;",";Y0
6940 REM GET A$:IF (A$ = "Q") THEN END
6960 IF (Y0 < 0) OR (Y0 > = GH) THEN 7040: REM LINE NOT ON SCREEN
6980 IF FILL = 0 THEN 7020
7000 HPLOT X1,Y0 TO R1X,Y0: GOTO 7040
7020 HPLOT X1,Y0 TO X0,Y0: HPLOT R0X,Y0 TO R1X,Y0
7040 IF (Y2 < 0) OR (Y2 > = GH) THEN 7120
7060 IF FILL = 0 THEN 7100
7080 HPLOT X1,Y2 TO R1X,Y2: GOTO 7120
7100 HPLOT X1,Y2 TO X0,Y2: HPLOT R0X,Y2 TO R1X,Y2
7120 Y0 = Y0 + 1:Y2 = Y2 - 1
7140 IF Y0 < = Y THEN 6960
7200 REM END OF DRAWING LINE
7220 I = I - DI
7240 GOTO 6200
7300 REM END OF RADIAN, PREPARE NEXT
7320 I = I - DI
7340 IF (I > I1) THEN 6300
7360 RETURN
6100 REM * IN: HC (HCOLOR)
6110 A=.06: F=.9982: HCOLOR=HC: R=1: REM R = ASPECT RATIO; CAN BE CHANGED TO DRAW ORTHOGONAL ELLIPSES
6120 FOR D=0 TO NOT FILL STEP .5
6130 X=RADIUS-D: Y=0: HPLOT X+CX,CY
6140 FOR I=1 TO 6.3/A: H=Y*A*R+X: Y=(Y-A*X/R)*F: X=F*H: HPLOT TO X+CX,Y+CY
6150 NEXT: NEXT: IF NOT FILL THEN RETURN
6160 REM FILL IN CIRCLE, IF SPECIFIED (NEVER USED)
6170 Y=0: FOR X=1-RADIUS TO 0
6180 FOR I=0 TO 1: I=HSCRN(CX+X,CY+Y): Y=Y+NOT I: NEXT
6190 HPLOT CX-X,CY-Y TO CX-X,CY+Y: HPLOT CX+X,CY-Y-1 TO CX+X,CY+Y
7290 NEXT: RETURN
7300 REM DISPLAY TABLE OF WORDS AND THEIR DIFFICULTY SCORES (NOT USED)
7320 TEXT:PR#3:H=1:X=0:Y=0:Z=0
7330 IF NOT R THEN RESTORE : FOR D = 1 TO 105: READ A$: REM ORIGINAL VERSION
7340 IF R THEN FOR D=1 TO 105:A$=W$(ASC(MID$(L$,D,1))): REM REVISED VERSION
7350 GOSUB 12120:IF PEEK(37)>20 THEN H=H+16:VTAB 1
7360 I=(WD<=.36)-(WD>.66):X=(I=1)+X:Y=Y+NOT I:Z=(I<0)+Z:WD=INT(WD*100+.5)/100+.003:HTAB (WD<10)+H:
7370 PRINT LEFT$(STR$(WD),5-(WD<10)) SPC(1) LEFT$(A$,9):NEXT:PRINT:PRINT "X=" X " Y=" Y " Z=" Z;
7380 IF R THEN PRINT SPC(1) C(1) "," C(2) "," C(3) SPC(1) S(1) "-" S(2) "-" S(3)
7390 END
7400 REM ==DISPLAY STATUS==
7420 REM HOME
7440 IF CHEET = 0 THEN 7520
7440 IF NOT CHEET THEN 7520
7460 VTAB 21: HTAB 1: CALL -868: PRINT "* Pssst... the word is ";SECRET$;"."
7480 D = 2: GOSUB 800
7500 CHEET=0
7520 I = SW / 2 - LEN (HIDDEN$) / 2
7540 IF I < 1 THEN 7580
7560 VTAB 22: HTAB I
7520 I = (SW - LEN (HIDDEN$)) / 2
7540 IF I >= 1 THEN VTAB 22: HTAB I
7580 PRINT HIDDEN$
7600 RETURN
7620 :
7640 :
7700 REM ==GET A GUESS==
7720 OGUESS$ = ""
7740 FOR I = 0 TO 25
7760 IF (GZ%(I) > 0) THEN 7820
7780 OGUESS$ = OGUESS$ + CHR$ ( ASC ("A") + I)
7800 GOTO 7840
7820 OGUESS$ = OGUESS$ + "."
7840 NEXT I
7860 VTAB 23: CALL - 868
7880 VTAB 24: HTAB 1: PRINT "Guess? (";OGUESS$;") ";
7900 GOSUB 1800:GUESS$ = A$
7920 IF (GZ%( ASC (A$) - ASC ("A")) = 0) THEN 7980
7940 GOSUB 14300: REM RING BELL ON DUPE GUESS
7960 GOTO 7880
7980 GZ%( ASC (A$) - ASC ("A")) = 1
7900 GOSUB 1800: L=ASC(A$) - 64
7920 IF MID$(OGUESS$,L,1) = "." THEN GOSUB 14300: GOTO 8900: REM RING BELL ON DUPE GUESS
7940 OGUESS$ = MID$(OGUESS$,1,L - 1) + "." + MID$(OGUESS$,L + 1): REMOVE FROM OGUESS$
7980 GUESS$ = A$
8000 HTAB 1: CALL - 868
8020 L=ASC(A$) - ASC("A") + 1:FOR I=1 TO L:D=RND(1):NEXT I:REM TWEAK RANDOM
8020 REM FOR I=0 TO L:D=RND(1):NEXT I:REM TWEAK RANDOM
8025 RETURN
8040 :
8060 :
8100 REM ==CHECK GUESS==
8120 OK = 0:DUP = 0:TK = 0:NHIDDEN$ = ""
8140 FOR I = 1 TO LEN (SECRET$)
8160 IF I = 1 THEN 8200
8180 NHIDDEN$ = NHIDDEN$ + " "
8120 OK = 0:TK = 1:NHIDDEN$ = "": VTAB 22
8140 A = LEN (SECRET$): FOR I = 1 TO A
8160 IF I > 1 THEN NHIDDEN$ = NHIDDEN$ + " "
8200 A$ = MID$ (HIDDEN$,2 * I - 1,1)
8220 IF (A$ = "_") THEN 8260
8240 TK = TK + 1
8260 IF ( MID$ (SECRET$,I,1) < > GUESS$) THEN 8340
8280 IF (A$ = GUESS$) THEN DUP = 1
8300 A$ = GUESS$
8320 OK = OK + 1
8220 TK = (A$ < "_") + TK
8260 D = MID$ (SECRET$,I,1) = GUESS$: IF D THEN A$ = GUESS$: OK = OK + 1
8340 NHIDDEN$ = NHIDDEN$ + A$
8360 NEXT I
8380 IF (DUP = 1) THEN 8900
8400 IF (OK = 0) THEN 9000
8420 TK = TK + OK
8440 IF TK = LEN (SECRET$) THEN 9400
8360 IF D THEN HTAB 20 - A: PRINT NHIDDEN$; CHR$(7);: GOSUB 800
8380 NEXT I: PRINT: PRINT
8400 IF NOT OK THEN 9000
8440 IF TK + OK = I THEN 9400: REM WORD IS COMPLETE
8500 REM CORRECT GUESS
8520 IF (SND > 0) THEN POKE 768,32: POKE 769,12: CALL 770
8540 RARE$ = "QZXJ":FRARE = 0
8560 FOR I = 1 TO LEN (RARE$)
8580 IF ( MID$ (RARE$,I,1) = GUESS$) THEN FRARE = 1
8600 NEXT I
8620 IF FRARE = 0 THEN 8660
8640 PRINT "Glorious!!!";: GOTO 8780
8660 I = INT ( RND (1) * 3) + 1
8680 ON I GOTO 8720,8740,8760
8700 PRINT "Whaa? This wasn't supposed to happen.";: GOTO 8780
8620 D = 3518034/(127 - ASC(GUESS$)): I = INT ( RND (1) * 3)
8660 IF INT(D)=D THEN PRINT MID$("AwesomeGloriousEpic",I*8+NOT I,I+7) "!!!";: GOTO 8780: REM JUST FOR JQXZ
8680 ON I GOTO 8740,8760
8720 PRINT "Bah! Lucky guess.";: GOTO 8780
8740 PRINT "Nice work!";: GOTO 8780
8760 PRINT "Good job!";: GOTO 8780
8760 PRINT "Good job!";
8780 HIDDEN$ = NHIDDEN$
8800 D=2: GOSUB 800:HTAB 1: CALL -868:GOTO 9520
8800 HTAB 1: GOTO 9100
8900 REM DUPLICATE GUESS
8920 PRINT "You already guessed '";GUESS$;"'.";
8940 GOTO 9520
8920 VTAB 24: HTAB 1: PRINT "You already guessed '";A$;"'.";
8940 CALL -868: D=2: HTAB 1: GOSUB 800: CALL -868: GOTO 7880
9000 REM WRONG GUESS
9020 I=20: GOSUB 14200: REM BZZZ
9040 PRINT "Wrong! The secret word has no '";GUESS$;"'.";
9060 NLIMBS = NLIMBS + 1
9080 GOSUB 4100: REM SHOW NEWLY ADDED LIMB ON THE GALLOWS
9100 IF (LIMBS$(NLIMBS + 1) = "***HANGMAN***") THEN 9200
9120 D=1: GOSUB 800:CALL -868:GOTO 9520
9080 GOSUB 4000: REM SHOW NEWLY ADDED BODY PART ON THE GALLOWS
9100 D=2: IF NLIMBS<10 THEN GOSUB 800:CALL -868:RETURN
9200 REM YOU LOSE
9220 GAMEOVER = 1
9240 PRINT : HTAB 1: CALL -868: PRINT "You lose. The secret word was... "
9260 HTAB 1: CALL -868: PRINT " ";SECRET$;"."
9280 A$ = "48 ,27 ,57 ,54 ,72 ,54 ,114,255.": GOSUB 14000
9300 GOTO 9520
9280 REM A$ = "48 ,27 ,57 ,54 ,72 ,54 ,114,255.": GOSUB 14000
9300 RETURN
9400 REM YOU WIN
9420 HTAB 1: CALL -868: PRINT "You WIN! You solved the secret word, "
9440 HTAB 1: CALL -868: PRINT " ";SECRET$;"."
9460 A$ = "128,27 ,114,54 ,114,54 ,85 ,216.": GOSUB 14000
9460 REM A$ = "128,27 ,114,54 ,114,54 ,85 ,216.": GOSUB 14000
9480 GAMEOVER = 1
9500 GOSUB 5200
9520 RETURN
9540 :
9560 :
9500 GOTO 3500: REM DRAW SMILEY FACE
9600 REM ==SELECT WORD==
9620 HOME:VTAB 24:PRINT "Choosing word, please wait...";
9620 HOME:VTAB 24:REM PRINT "Choosing word, please wait...";
9640 NR = 0
9660 NR = NR + 1: IF (NR > 100) THEN ES$ = "COULD NOT LOAD A VALID WORD": GOTO 1620
9660 NR = NR + 1: IF NR > 100 THEN ES$ = "COULD NOT LOAD A VALID WORD": GOTO 1620
9680 IF NW < = 0 THEN ES$ = "NO WORDS LOADED": GOTO 1620
9700 RESTORE
9720 WI = INT ( RND (1) * NW) + 1
9740 IF WI = WO THEN 9720: REM DON'T PICK SAME WORD
9760 FOR I = 1 TO WI
9780 READ SECRET$
9800 NEXT I
9820 OK = 0:AA = ASC ("A"):AZ = ASC ("Z")
9840 FOR I = 1 TO LEN (SECRET$)
9860 C = ASC ( MID$ (SECRET$,I,1))
9880 IF (C < AA) OR (C > AZ) THEN 9920
9900 OK = OK + 1
9920 NEXT I
9940 IF ( LEN (SECRET$) < 3) OR ( LEN (SECRET$) > 20) THEN OK = 0: GOTO 10200
10000 REM IF (EZ = 1) AND ( LEN (SECRET$) > 5) THEN OK = 0: GOTO 10200
10020 A$ = SECRET$: GOSUB 12100: REM SET WD=WORD DIFFICULTY
10100 REM HTAB 1:PRINT "___ ";SECRET$;" = ";WD
10120 IF (EZ = 1) AND (WD > 0.36) THEN OK = 0
10140 IF (EZ = 2) AND ((WD < = 0.36) OR (WD > 0.66)) THEN OK = 0
10160 IF (EZ = 3) AND (WD < = 0.66) THEN OK = 0
10180 IF (OK > 0) THEN 10320
10200 REM ==WORD NOT OK, PICK ANOTHER==
10220 WI = WI + 1
10240 IF (WI > NW) THEN GOTO 9660
10260 NR = NR + 1: IF (NR > 100) THEN ES$ = "COULD NOT LOAD A VALID WORD": GOTO 1620
10280 READ SECRET$
10300 GOTO 9820
9690 REM NEW SIMPLIFIED ALGORITHM (WITH ALL WORDS NOW ALREADY GROUPED BY DIFFICULTY)
9700 REM GOES THROUGH ALL WORDS IN GROUP ONCE; AFTERWARD PICKS FROM GROUP'S 9 WORDS LEAST RECENTLY SEEN
9710 WI = INT((C(EZ)+9*NOT C(EZ))*RND(1))+S(EZ)
9720 C(EZ) = C(EZ)-(C(EZ)>0)
9730 SECRET$ = W$(ASC(MID$(L$,WI,1))): REM FIND WORD IN INDEXED ARRAY
9740 REM MOVE CHOSEN WORD TO THE END OF ITS GROUP SO IT WON'T BE PICKED AGAIN FOR A LONG TIME
9750 IF WI+1<S(EZ+1) THEN L$ = MID$(L$,1,WI-1)+MID$(L$,WI+1,S(EZ+1)-WI-1)+MID$(L$,WI,1)+MID$(L$,S(EZ+1))
10320 WO = WI
10400 REM SECRET$="TYRANNOSAURUS REX" : REM FOR TESTING
10420 HIDDEN$ = ""
10440 FOR I = 1 TO LEN (SECRET$)
10460 IF I = 1 THEN 10500
10480 HIDDEN$ = HIDDEN$ + " "
10500 C = ASC ( MID$ (SECRET$,I,1))
10520 IF (C < AA) OR (C > AZ) THEN 10560
10540 HIDDEN$ = HIDDEN$ + "_": GOTO 10580
10560 HIDDEN$ = HIDDEN$ + MID$ (SECRET$,I,1)
10580 NEXT I
10520 IF C < AA OR C > AZ THEN 10560
10540 HIDDEN$ = HIDDEN$ + " _": GOTO 10580
10560 HIDDEN$ = HIDDEN$ + " " + MID$ (SECRET$,I,1)
10580 NEXT I: HIDDEN$ = MID$(HIDDEN$,2)
10600 HTAB 1: CALL - 868: REM ERASE STATUS MESSAGE
10620 RETURN
10640 :
10660 :
10700 REM ==COUNT AVAILABLE WORDS==
10720 REM THE ARRAYS BELOW ARE USED TO CALCULATE LETTER FREQUENCIES, WHICH IN
10740 REM TURN ARE USED TO CATEGORIZE WORDS INTO EASY, MEDIUM, AND HARD LEVELS.
10760 REM THE FQ TABLE IS INITIALIZED TO THE FREQUENCIES CORRESPONDING TO
10780 REM OVERALL ENGLISH LANGUAGE USAGE. IF CQ<>0, THEN WE OVERWRITE THESE
10800 REM WITH THE FREQS DETERMINED FROM THE WORD LIST ITSELF, WHICH IS MORE
10800 REM WITH THE FREQS DETERMINED FROM THE WORD LIST ITSELF, WHICH IS
10820 REM MORE ACCURATE BUT TAKES A LOT OF TIME TO DO AT STARTUP.
10840 DIM FQ(27),FC(27)
10860 FQ(0) = 8.167: REM "A"
10880 FQ(1) = 1.492
10900 FQ(2) = 2.782
10920 FQ(3) = 4.253
10940 FQ(4) = 12.702
10960 FQ(5) = 2.228
10980 FQ(6) = 2.015
11000 FQ(7) = 6.094
11020 FQ(8) = 6.966
11040 FQ(9) = 0.153
11060 FQ(10) = 0.772
11080 FQ(11) = 4.025
11100 FQ(12) = 2.406
11120 FQ(13) = 6.749
11140 FQ(14) = 7.507
11160 FQ(15) = 1.929
11180 FQ(16) = 0.095
11200 FQ(17) = 5.987
11220 FQ(18) = 6.327
11240 FQ(19) = 9.056
11260 FQ(20) = 2.758
11280 FQ(21) = 0.978
11300 FQ(22) = 2.360
11320 FQ(23) = 0.150
11340 FQ(24) = 1.974
11360 FQ(25) = 0.074: REM "Z"
10840 DIM W$(105),S(4),C(3),FQ(27),FC(27)
10860 DATA 8.167,1.492,2.782,4.253,12.702,2.228,2.015,6.094,6.966
11040 DATA .153,.772,4.025,2.406,6.749,7.507,1.929,.095,5.987
11220 DATA 6.327,9.056,2.758,.978,2.360,.150,1.974,.074,0
11380 CQ = 0
11400 FOR I = 0 TO 26:FC(I) = 0: NEXT I
11420 RESTORE :NW = 0:NB = 0
11400 NW = 0:NB = 0:L$ = ""
11420 FOR I = 0 TO 26: READ FQ(I): FC(I) = 0: NEXT I
11440 READ SECRET$
11460 IF SECRET$ = "*NO MORE WORDS*" THEN 11700
11480 IF (CQ = 0) THEN 11620
11500 L = LEN (SECRET$):AA = ASC ("A"):AZ = ASC ("Z")
11480 L = LEN (SECRET$): IF CQ = 0 THEN 11620
11500 AA = ASC ("A"): AZ = ASC ("Z")
11520 FOR I = 1 TO L
11540 C = ASC ( MID$ (SECRET$,I,1))
11560 IF (C < AA) OR (C > AZ) THEN 11600
11560 IF C < AA OR C > AZ THEN 11600
11580 C = C - AA:FC(C) = FC(C) + 1
11600 NEXT I
11620 NW = NW + 1
11620 NW = NW + 1: L$ = L$ + CHR$(NW): W$(NW) = SECRET$: REM STORE WORDS IN AN INDEXED ARRAY
11640 IF NW > 10000 THEN ES$ = "INVALID WORD DATA": GOTO 1620
11660 IF ( LEN (SECRET$) < 3) OR ( LEN (SECRET$) > 20) THEN NB = NB + 1
11660 IF L < 3 OR L > 20 THEN NB = NB + 1
11680 GOTO 11440
11700 IF (NW < 1) OR (NB > = NW) THEN ES$ = "INVALID WORD DATA": GOTO 1620
11700 IF NW < 1 OR NB > = NW THEN ES$ = "INVALID WORD DATA": GOTO 1620
11800 REM COMPUTE ALPHABET FREQUENCIES
11820 FOR I = 0 TO 25:FC(26) = FC(26) + FC(I): NEXT I
11840 IF CQ = 0 THEN 11900
11860 FOR I = 0 TO 25:FQ(I) = FC(I) * 100 / FC(26): NEXT I
11840 IF CQ THEN FOR I = 0 TO 25:FQ(I) = FC(I) * 100 / FC(26): NEXT I
11900 REM GOSUB 12600
11920 REM GOSUB 12800
11940 REM A$="YAK": GOSUB 12100
11942 VTAB 22:PRINT:CALL -958
11943 REM GROUP WORDS INTO EASY, MEDIUM, AND HARD BY REARRANGING INDEX STRING L$
11944 S(1)=1:S(2)=1:S(3)=1:S(4)=NW+1:J=1:FOR R=1 TO NW:A$=W$(R):GOSUB 12120
11946 D = (WD > .66)-(WD <= .36): C(D+2)=C(D+2)+1: S(2)=(D<0)+S(2): S(3)=(D<1)+S(3)
11948 IF D<0 AND R>1 THEN L$ = MID$(L$,J,1)+LEFT$(L$,J-1)+MID$(L$,J+1)
11950 IF D=1 THEN L$ = MID$(L$,1,J-1)+MID$(L$,J+1)+MID$(L$,J,1)
11952 J=(D<1)+J:NEXT:L$=L$+"X":REM R=1:GOTO 7370
11960 RETURN
11980 :
12000 :
12100 REM ==CALCULATE WORD DIFFICULTY==
12120 IF (FQ(0) < = 0) THEN 12440
12120 IF FQ(0) < = 0 THEN 12440
12140 WD = 0:AA = ASC ("A"):AZ = ASC ("Z")
12160 L = LEN (A$)
12180 FOR I = 1 TO L
12200 C = ASC ( MID$ (A$,I,1))
12220 IF (C < AA) OR (C > AZ) THEN 12280
12220 IF C < AA OR C > AZ THEN 12280
12240 QC = FQ(C - AA)
12260 WD = WD + 1 / (QC * QC)
12280 NEXT I
12300 IF (WD < = 0) OR (L < = 0) THEN 12440
12400 REM WD = WD / L
12420 GOTO 12500
12440 WD = 0
12300 IF WD < = 0 OR L < = 0 THEN WD = 0
12345 REM IF A SHORT WORD AND A LONG WORD SCORED THE SAME, THE SHORT WORD MUST HAVE 'HARDER' LETTERS
12400 WD = WD * 2.25 / SQR(L): REM
12500 REM HTAB 1:PRINT:PRINT "DIFFICULTY FOR ";A$;" = ";WD;".":PRINT
12520 RETURN
12540 :
12560 :
12600 REM ==PRINT FREQUENCIES==
12620 HTAB 1: PRINT : PRINT
12640 AA = ASC ("A")
@ -538,8 +392,7 @@
12700 NEXT I
12720 PRINT : INPUT "PRESS RETURN TO CONTINUE...";A$
12740 RETURN
12760 :
12780 :
12800 REM ==CALCULATE AVERAGE WORD DIFFICULTY==
12820 RESTORE
12840 NW = 0:TD = 0:D0 = 999999:D9 = - 1:W0$ = "":W9$ = ""
@ -558,14 +411,13 @@
13100 PRINT "HARDEST WORD = ";D9;", ";W9$
13120 PRINT : INPUT "PRESS RETURN TO CONTINUE...";A$
13140 RETURN
13160 :
13180 :
13200 REM ==================
13220 REM DATA SECTION:
13240 REM SECRET WORDS ARE
13260 REM LISTED BELOW.
13280 REM ==================
13300 NW = 0: REM NUMBER OF WORDS LOADED
13300 NW = 0: REM NUMBER OF WORDS LOADED (= 105)
13320 SECRET$ = ""
13340 WI = - 1: REM SECRET WORD #
13360 WO = - 1: REM PREVIOUS SECRET WORD #
@ -575,39 +427,25 @@
13440 DATA JELLYFISH,KANGAROO,KRILL,LEMUR,LEOPARD,LION,LIZARD,LLAMA,LOBSTER,LYNX,MOLE,MONKEY,MOOSE,NEWT
13460 DATA OCTOPUS,OKAPI,OPOSSUM,ORANGUTAN,OTTER,OWL,PANDA,PENGUIN,PIG,POLAR BEAR,PORCUPINE,PUMA,QUAIL
13480 DATA RABBIT,RACCOON,REINDEER,RHINOCEROS,SCORPION,SEA LION,SEAL,SHARK,SHRIMP,SNAIL,SNAKE,SPIDER,SQUID
13500 DATA SQUIRREL,TIGER,TOAD,TORTOISE,TUNA,TURKEY,TURTLE,TYRANNOSAURUS REX,VOLE,VULTURE,WALRUS,WARTHOG,WASP,WHALE,WILDCAT,WILDEBEEST
13520 DATA WOLF,WORM,YAK,ZEBRA
13540 DATA "*NO MORE WORDS*"
13500 DATA SQUIRREL,TIGER,TOAD,TORTOISE,TUNA,TURKEY,TURTLE,TYRANNOSAURUS REX,VOLE,VULTURE,WALRUS,WARTHOG,WASP,WHALE,WILDCAT
13520 DATA WILDEBEEST,WOLF,WORM,YAK,ZEBRA
13540 DATA *NO MORE WORDS*
13600 REM THIS VERSION OF THE PROGRAM
13620 REM HAS DATA BUILT-IN, RATHER
13640 REM THAN USING A DATAFILE.
13660 GOSUB 10700
13680 RETURN
13700 :
13720 :
13800 REM ==INSTALL TONE GENERATOR==
13820 IF (SND = 0) THEN 13880
13840 POKE 770, 173: POKE 771, 48: POKE 772, 192: POKE 773, 136: POKE 774, 208: POKE 775, 5: POKE 776, 206: POKE 777, 1: POKE 778, 3: POKE 779, 240
13860 POKE 780, 9: POKE 781, 202: POKE 782, 208: POKE 783, 245: POKE 784, 174: POKE 785, 0: POKE 786, 3: POKE 787, 76: POKE 788, 2: POKE 789, 3: POKE 790, 96
13880 RETURN
13900 :
13920 :
14000 REM ==PLAY TUNE==
13660 GOTO 10700
13800 REM ==INSTALL TONE GENERATOR== (REMOVED)
13820 RETURN
14000 REM ==PLAY TUNE== (REMOVED)
14020 REM A$ = "128,27 ,114,54 ,114,54 ,85 ,216."
14040 IF (SND = 0) THEN 14140
14060 L=LEN(A$)
14080 I=1
14100 IF (I+7 > L) THEN 14140
14120 POKE 768,VAL(MID$(A$,I,3)): POKE 769,VAL(MID$(A$,I+4,3)): CALL 770: I = I + 8: GOTO 14100
14140 RETURN
14160 :
14180 :
14040 RETURN
14200 REM ==BUZZ SPEAKER==
14220 L=PEEK(-16336):I=I-1:IF (I > 0) THEN 14220
14220 L=PEEK(-16336):I=I-1:IF I > 0 THEN 14220
14240 RETURN
14260 :
14280 :
14300 REM ==RING BELL==
14320 IF (SND = 0) THEN 14360
14340 CALL -198: REM COULD ALSO JUST PRINT CHR$(7)
14340 PRINT CHR$(7);
14360 RETURN

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"