Three challenges, actually. This is not a full-blown contest. There won’t be any prizes except the fun of working on the problem and the satisfaction of having your work acknowledged publicly. But maybe that’ll be enough for you. If there’s a good response to this one, we’ll give you more. Or maybe some of you readers would like to submit your own posers.
The “Flowchart” LISTing shown was picked up somewhere by Paul Holmgren. He doesn’t remember where he got it–maybe some of you readers can help with that, too. The program (TS2068 version), as Paul provided it, starts at Line 9000. The rest of it is a synthetic demo sequence that I plugged in. (And if you use it, be careful that you never activate line 90. If you just use a standard RUN or GO TO 1, then line 10 neatly avoids the problem.) While I’m at it, I’ll admit that I made a couple of other minor changes in the program, but nothing drastic.
The results, with the demo sequence as shown in lines 1-410, are displayed in the printout.
The author of the program has gone to some trouble to save memory. Notice the liberal use of VALs and NOT PIs. And then he wastes memory in lines 9907 and 9908, when he could just as well have used the techniques of line 9909. Maybe those two lines were added by some latecomer.
At any rate, I calculated the amount of memory used as follows:
DELETE all lines lower than 9000
CLEAR
PRINT FREE
Turn off the machine; turn it back on again
PRINT FREE again
The difference between the two FREE readings, 2181, is the number of bytes used by the program.
Now, here are the challenges.
1. Reduce the memory required by the BASIC version of this program to the barest minimum.
2. Create a machine-code equivalent.
3. Write an equivalent program (BASIC or machine code) for the TS1000.
You don’t have to do all three, of course. You don’t even have to do one of them completely. A rough draft, or a “road map” of the full program might interest, provoke, or inspire our readers as much as the final program would.
And here are the scoring rules:
1. We’ll print the names of all who contribute programs or suggestions that come anywhere near meeting the rules, unless the entrants specifically ask not to be identified publicly.
2. We’ll print a commentary on programs or suggestions with unusually interesting features. We may even print the entire program, if it’s really noteworthy.
3. We’ll pay our usual authors’ rates for any descriptive article that we consider worthy. (“Worthy” includes elimination of duplicate, or similar, articles, of course.) However, we reserve the right to print your listings and simple analyses without paying you, except in immortality. All decisions in this area will be ours–however, we promise you a fair shake.
I’ll evaluate programs (perhaps in consultation with colleagues, friends, or casual acquaintances) according to the following criteria:
1. How well does the program do the job, and how economical of memory is it?
2. How well can I (and our readers) understand what the program is doing? It’s important for you to describe fully what the program is doing, and how it does it.
I’m more likely to make a thorough evaluation if you send a tape of the program. And by all means, include (as usual) your name, address, and telephone number in a REM statement on the tape, as well as on the tape label. Plus an indication on the label of what machine the tape is for, along with an indication of any special requirements, like extra memory, etc.
Here are a couple of improvements that I would like to see incorporated in the program:
1. It would be nice to be able to “drop in ” on the program at any point you choose, rather than having to start at the beginning each time. This would be particularly useful in chasing down GO TOs and GO SUBs.
2. I have a feeling somewhere between patronizing amusement and total outrage at the treatment of the NEW command. Properly speaking, an encounter with NEW should be accompanied by clanging lights and flashing whistles, or vice versa. So should USR, maybe. And DELETE. But it’s particularly bizarre to see NEW accompanied by a symbol that indicates that there is a next step.
Anyway, there you have it. Let’s hear from you.
1 CLS
10 IF 5>1 THEN GO TO 9000
20 FOR f=1 TO 3: PRINT 5: NEXT f
30 GO SUB 400
40 LOAD ""
50 PRINT 1
60 STOP
70 LOAD "a"
80 SAVE "a" LINE 10: BEEP .3,12: BEEP 1,12: VERIFY "a": BEEP .3,16: BEEP 1,16
90 NEW
100 LIST 10
350 STOP
400 PRINT 123: RETURN
410 STOP
9901 LET a=VAL "PEEK 23635+256*PEEK 23636"
9902 LET c=NOT PI: LET y=VAL "175": LET x=VAL "130"
9903 LET l=PEEK (a+1)+256*PEEK a: LET a=a+4
9904 IF l>=9900 THEN GO TO VAL "9948"
9905 PRINT l;TAB 5;CHR$ PEEK a: LET c=c+2: PRINT
9906 PLOT x,y: LET b=PEEK a
9907 IF b=226 OR b=234 OR b=242 OR b=254 THEN GO TO 9923
9908 IF b>227 AND b<231 OR b=232 OR b=235 OR b=241 OR b=247 OR b=249 OR b=253 THEN GO TO 9924
9909 IF b=CODE " NEXT " OR b=CODE " IF " THEN GO TO 9925
9910 IF b=CODE " GO TO " OR b=CODE " GO SUB " THEN GO TO 9933
9911 DRAW 16,0: DRAW -4,-8: DRAW -28,0: DRAW 4,8: DRAW 12,0
9912 LET y=y-8
9913 IF b=226 OR b=236 OR b=237 OR b=254 THEN GO TO 9915
9914 PLOT x,y: DRAW 0,-7: DRAW 4,4: DRAW -4,-4: DRAW -4,4
9915 LET y=y-8
9916 LET b=PEEK a: IF b=34 THEN GO SUB 9951
9917 IF b=14 THEN LET a=a+4
9918 IF b=13 THEN GO TO 9921
9919 IF b=CODE ":" THEN GO TO 9939
9920 LET a=a+1: GO TO 9916
9921 IF c=22 THEN GO TO 9942
9922 LET a=a+1: GO TO 9903
9923 DRAW 12,0: DRAW 4,-8,-PI: DRAW -24,0: DRAW -4,8,-PI: DRAW 12,0: GO TO 9912
9924 DRAW 16,0: DRAW 0,-8: DRAW -32,0: DRAW 0,8: DRAW 16,0: GO TO 9912
9925 DRAW 8,-4: DRAW 8,0: DRAW -4,4: DRAW 4,-4: DRAW -4,-4: DRAW 4,4: DRAW -8,0: DRAW -8,-4: DRAW -8,4: DRAW 8,4
9926 IF b=243 THEN GO TO 9932
9927 LET a=a+1: LET f=PEEK a
9928 IF f=14 THEN LET a=a+4
9929 IF f<>203 THEN GO TO 9927
9930 LET a=a+1: LET f=PEEK a: PRINT AT c-2,19;CHR$ f: PRINT
9931 IF f=236 OR f=237 THEN GO TO 9934
9932 GO TO 9912
9933 CIRCLE x,y-4,4: PLOT x+4,y-4: DRAW 64,0: DRAW -4,4: DRAW 4,-4: DRAW -4,-4: PLOT x,y
9934 LET a=a+1: LET f=PEEK a
9935 IF f<>14 THEN GO TO 9934
9936 LET a=a+3: LET g=PEEK a+256*PEEK (a+1)
9937 PRINT AT c-2,26;g: PRINT
9938 GO TO 9912
9939 IF c=22 THEN GO TO 9942
9940 LET a=a+1: PRINT " : ";CHR$ PEEK a: PRINT : LET c=c+2
9941 GO TO 9906
9942 PRINT #0; BRIGHT SGN PI;"""c"" TO CONTINUE ;""p"" TO PRINT ": PAUSE 0
9943 IF INKEY$="c" THEN GO TO VAL "9946"
9944 IF INKEY$="p" THEN INPUT ;: COPY : GO TO VAL "9946"
9945 GO TO VAL "9943"
9946 CLS : LET d=0: LET e=22: LET c=d: LET x=130: LET y=175
9947 IF PEEK a=CODE ":" THEN GO TO 9940
9948 IF l>=9900 THEN PRINT #NOT PI;" End of basic program": PAUSE NOT PI: STOP
9949 GO TO 9922
9951 LET a=a+1: LET b=PEEK a: IF b=34 THEN RETURN
9952 GO TO 9951
LISTing of “FLOWCHART”

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.