Authors
Publication
Publication Details
Volume: 2 Issue: 1
Date
Pages
Is It A Number?
By Fred Nachbaur
The following routine contains a trap to insure that you enter a number. This is useful in math drill programs, to prevent cheating by entering an expression. The BASIC interpreter will accept the question as the answer by evaluating the expression for you. For example, in response to the question, “How much is 2+2?”, by INPUTing 2+2, the computer will accept it as the correct answer. This routine eliminates the chance of the + being INPUT as part of a valid response. This also holds true for any character other than numbers.
Another trick in this program is the way it prints to the screen. It POKEs the display file directly. To insure proper execution, this routine needs a padded out (full) display. (PEEK 16400+256*PEEK 16401)- (PEEK 16396+256* PEEK 16397) should equal 792, If you don’t have 16K, then POKE 16389,100, to fake it.
5 SLOW
10 LET B=PEEK 16396+256*PEEK 16397+762
20 LET E$="ILLEGAL ENTRY"
100 PRINT "ENTER A NUMBER"
110 INPUT D$
120 IF D$="" THEN GOTO 170
130 FOR C=1 TO LEN D$
140 IF D$(C)<>"." AND (CODE D$(C)<28 OR CODE$(C)>37) THEN GOTO 170
150 NEXT C
160 GOTO 300
170 POKE 16418,0
180 FOR C=1 TO LEN E$
190 POKE B+C,CODE E$(C)
200 NEXT C
210 POKE 16418,2
220 GOTO 100
300 LET D=VAL D$
310 PRINT ,,D,,"THANK YOU"
2068 Felt Hat
By Paul Bingham
Paul sent along this little cutie. This is an excellent 3D play around program.
Z is the third dimension, running along the length of the hat, setting the lines apart by a certain amount. This value can be changed by the STEP value
in line 30.
C is the value that gives the curvature to each Z value before it is plotted. A slight change in the .033 value in line 60, can have a dramatic effect.
F holds the parameters for where each line starts and stops. Adjusting the initial and ending values of L in the loop in line 50, will dramatically adjust the size of the hat “brim”, Altering the STEP value in line 50, will give you more or less points on each line. A higher number means a quicker run and therefore less time consuming for making adjustments.
Lines 70 and 80 hold the final values to be PLOTted on the screen. Changing these values will center or stretch the hat in different ways. Have fun!
10 REM Felt Hat for 2068
20 BORDER 1: PAPER 1: INK 6
30 FOR Z=-142 TO 150 STEP 12
40 LET L=INT (SQR (ABS (1-(Z*Z)/22500))*176+.5)
50 FOR F=-L-3 TO L+4 STEP 4
60 LET C=SIN (.033*SQR (Z*Z+F*F))*30
70 LET X=220-(240+Z-F)/2.5
80 LET Y=Z/6+110+C
90 PLOT X,Y
100 NEXT F
110 NEXT Z