Jump to:
Sevens Problem - Two answers ||
Graphics on the TI:
Points on a circle ||
Ikeda map | |
Turtle graphics
Games Module Reviews:
4A Flyer ||
Frogger ||
D Station ||
Defender ||
TI Invaders ||
Hopper ||
MS Pac-Man ||
Munch Man ||
Munch Man II
This web page contains the text of articles for owners of the TI-99/4a from Issue 29 of TI*MES. It is of use to users of the TI-99/4a emulators.
Back in Issue 27, on page 20 I set two Tests. Not a single response to either of them. However, I have now discovered a whole series of questions of the type posed by Test 4, in The Master Book of Mathematical Recreations by Fred Schuh, published by Dover, ISBN 486-22134-2. Refer to puzzles 298 to 301. The same author, in the same book, claims the creation of (and describes) the puzzle Giant and Dwarfs -a program of this can be found on library disk Games-3.
No feedback at all on the module reviews (in fact unexpanded owners remain the great unknown, as they do not seem to want me to write anything for them - no letters anyway! Hello?) - so in this issue, a smaller number of module reviews. And remember that almost everything can be obtained from somewhere, even if you do have to try several US sources.
There is a disk program called Electric Harry bombing around - please be aware that it is a pirated version of Espial.
Equally 7^3 is SEVEN TO THE POWER OF THREE or 7 * 7 * 7.
Get the idea?
OK. Your test is to write a program, in any language, which will determine the first power of seven which has a result containing six sevens in succession-eg "777777". Clue: The result has MORE than 15 digits!
To make checking easy, your program should print the result:
"SEVEN TO THE POWER OF N IS" where of course N is the first power that gives a result matching our requirements, and also of course giving the actual result.
So how can a Basic program handle a problem which requires an answer with more than 14 digits? Simple! We allow the program to deal with numbers with less than 14 digits - and create our larger numbers from these smaller numbers. We do this all the time, and learn it in our first or second year of schooling. 2+2=4 is easy. Now try 8+8= ... the answer needs more than one number! We could call it sixteen, but to write every number with a separate character would slow learning down a mite. In writing numbers we use a decimal system, with the rightmost number representing a number of units, the number to the left of it the number of tens of units, and so on.
To solve this problem we must be much more specific in our instructions to the computer, which for our purposes is a dunce! (Though fortunately a fast one!).
We need our program to deal with the "carry"s! Then of course we need to work out how to actually do all the multiplications - how to store the little numbers making up the big number, how to get them back together for testing for the six sevens
We can test six digits from every character position, and we can speed things up by only testing every sixth character (or digit) and if - and only if - that is a seven, testing the numbers in front of and behind it. This short cut brings a useful increase in speed.
Here are the only listings sent to me up to the time this issue went to press:<
99 REM John Seager 100 !ANSWER TO TEST5/A 110 CALL CLEAR :: NUM$="1176 49" :: DISPLAY AT(1,1):"7 TO THE POWER OF" 120 FOR POWER=7 TO 300 :: DI S$=NUM$ :: NUM$="" :: CARRY, COUNT,SEVENS=0 130 FOR J=LEN(DIS$)TO 1 STEP -1 :: NEWNUM=(VAL(SEG$(DIS$ ,J,1))*7)+CARRY :: CARRY=INT (NEWNUM/10) 140 IF NEWNUM-CARRY*10<>7 TH EN COUNT=0 ELSE COUNT=COUNT+ 1 150 SEVENS=MAX(COUNT,SEVENS) :: NUM$=STR$((NEWNUM-CARRY)* 10)&NUM$ 160 NEXT J 170 IF CARRY>0 THEN NUM$=STR $(CARRY)&NUM$ :: IF CARRY=7 THEN COUNT=COUNT+1 180 SEVENS=MAX(COUNT,SEVENS) :: DISPLAY AT(1,19):STR$(POW ER);"=": :NUM$ 190 IF SEVENS<>6 THEN 210 EL SE DISPLAY AT(24,1):"ANY KEY TO CONTINUE" 200 CALL KEY(0,K,S):: IF S=0 THEN 200 :: DISPLAY AT(24,1 ) 210 NEXT POWER 220 REM WHY DOES THIS CRASH WHEN THE NUMBER OF DIGITS EX CEEDS 254 ... ====== 99 REM FASTER WAY John Seage r 100 ! ANSWER TEST5/B 110 CALL CLEAR :: DIM ELEM(2 6):: ELEM(0)=7 :: POWER,SS=0 :: DISPLAY AT(1,1):"7 TO TH E POWER OF" 120 ELM=SS :: SS,CARRY=0 :: POWER=POWER+1 130 DIS$=STR$(ELEM(ELM)):: F OR I=ELM-1 TO 0 STEP -1 :: D IS$=DIS$&RPT$("0",10-LEN(STR $(ELEM(I))))&STR$(ELEM(I)):: NEXT I 140 DISPLAY AT(1,19):STR$(PO WER);"=": : :DIS$ 150 FOR I=6 TO LEN(DIS$)STEP 6 :: IF SEG$(DIS$,I,1)<>"7" THEN 190 160 FOR J=I-5 TO I :: IF SEG $(DIS$,J,6)<>"777777" THEN 1 80 ELSE DISPLAY AT(24,1):"AN Y KEY TO CONTINUE" 170 CALL KEY(0,K,S):: IF S=0 THEN 170 :: DISPLAY AT(24,1 ):: J=I 180 NEXT J 190 NEXT I 200 ELEM(SS)=ELEM(SS)*7+CARR Y :: IF ELEM(SS+1)=0 AND ELE M(SS)<1.E+10 THEN 120 210 CARRY=INT(ELEM(SS)/1.E+1 0):: ELEM(SS)=ELEM(SS)-CARRY *1.E+10 220 SS=SS+1 :: GOTO 200
Now for some graphics programs for our latest addition to the TI graphic family, the Missing Link:
98 ! GRAPHICS PROGRAM FOR TI XB + THE MISSING LINK. S. S haw from JBM103 100 CALL LINK("CLEAR") 110 CALL LINK("WINDOW",0,10, 193,241) 120 CALL LINK("PRINT",2,9,"W hen ANY KEY is displayed") 130 CALL LINK("PRINT",79,1," press: to:") 140 CALL LINK("PRINT",30,1," CTRL FCTN ... PRINT TO PIO") 150 CALL LINK("PRINT",66,1," R run this program again") 160 CALL LINK("PRINT'",78,1, "A save to Artist file") 170 CALL LINK("PRINT",90,1," ANY OTHER for different rand om picture") 180 CALL LINK("PRINT",131,1, "right now...") 190 CALL LINK("PRINT",142,1, "PRESS R-RANDOM PIC") 200 CALL LINK("PRINT",153,1, "press I-INPUT VARIABLE") 210 CALL KEY(5,X,Y) 220 IF Y<1 THEN 210 230 RANDOMIZE 240 CALL LINK("CLEAR") 250 DIM A(30,1):: P=2*PI 260 IF X=73 THEN CALL LINK(" INPUT",160,200,N,2,"5"):: IF N>29 OR N<3 THEN 260 ELSE 2 80 270 N=INT(RND*26)+4 280 CALL LINK("PRINT",50,50, "ONE MOMENT...") 290 FOR X=0 TO N-1 :: A(X,0) =SIN(P/N*X)*96+128 :: A(X,1) =COS(P/N*X)*96+95 :: NEXT X 300 CALL LINK("CLEAR") 310 CALL LINK("PRINT",9,20," N="&STR$(N)) 320 FOR I=0 TO N-1 :: FOR II =I+1 TO N-1 :: CALL LINK("LI NE",A(I,1),A(I,0),A(II,I),A( II,0)):: NEXT II :: NEXT I 330 CALL LINK("PRINT",1,1,"A NY KEY") 340 CALL KEY(5,X,Y) 350 IF Y<1 THEN 340 360 IF X=82 THEN RUN 370 IF X<>65 THEN 230 380 CALL LINK("INPUT",1,1,A$ ,14,"DSK1.PICTURE") 390 CALL LINK("PRINT",1,1,"' ") 400 CALL LINK("SAVEP",A$) 410 GOTO 330
Ikeda map:
100 REM TML XB APRIL 1990 ST EPHEN SHAW ENGLAND 110 REM FOR TI XB + THE MISS ING LINK 120 REM 130 REM after john corbitt 140 CALL LINK("CLEAR") 150 CALL LINK("WINDOW",0,10, 193,241) 160 CALL LINK("PRINT",2,9,"W hen ANY KEY is displayed") 170 CALL LINK("PRINT",19,1," press: to:") 180 CALL LINK("PRINT",30,1," CTRL FCTN ....PRINT TO PIO") 190 CALL LINK("PRINT",66,1," R run this program again") 200 CALL LINK("PRINT",78,1," A save to artist file") 210 CALL LINK("PRINT",131,1, "right now...") 220 CALL LINK("PRINT",142,1, "PRESS SOMETHING...") 230 CALL KEY(5,A,B) 240 IF B<1 THEN 230 250 REM IKEDA MAP 260 REM from fractal report No 7 270 REM from program by John Corbit 16Aug89 FROM Myarc x b+ti99/4a s shaw feb 90 280 REM chaotic attractor ma p 290 REM 300 X,Y=0 :: P=7.70 310 REM 320 CALL LINK("CLEAR") 330 FOR N=1 TO 4399 340 COSTHETA=COS(.4-(P/(1+(X *X+Y*Y)))) 350 SINTHETA=SIN(.4-(P/(1+(X *X+Y*Y)))) 360 X1=.85+.9*X*COSTHETA-.9* Y*SINTHETA 370 Y1=.9*X*SINTHETA+.9*Y*CO STHETA 380 CALL LINK("PIXEL",(X1+1) *63+1,(Y1+1.7)*85+1) 390 X=X1 :: Y=Y1 400 NEXT N 410 CALL LINK("PRINT",1,1,"A NY KEY") 420 CALL KEY(5,A,B) 430 IF B<1 THEN 420 440 IF A=82 THEN RUN 450 IF A<>65 THEN 420 460 CALL LINK("INPUT",1,1,A$ ,14,"DSK1.PICTURE") 470 CALL LINK("PRINT",1,1,"' ") 480 CALL LINK("SAVEP",A$) 490 GOTO 410
100 ! TI XB plus THE MISSING LINK Turtle type graphics 110 REM TML EX BAS MARCH 199 0 STEPHEN SHAW ENGLAND 120 REM 130 CALL LINK("CLEAR") 140 CALL LINK("WINDOW",0,10, 193,241) 150 CALL LINK("PRINT",2,9,"W hen ANY KEY is displayed") 160 CALL LINK("PRINT",19,1," press: to:") 170 CALL LINK("PRINT",30,1," CTRL FCTN ....PRINT TO PIO") 180 CALL LINK("PRINT",66,1," R run this program again") 190 CALL LINK("PRINT",78,1," A save to artist file") 200 CALL LINK("PRINT",131,1, "right now...") 210 CALL LINK("PRINT",142,1, "PRESS SOMETHING...") 220 CALL KEY(5,A,B) 230 IF B<1 THEN 220 240 CALL LINK("PUTPEN",142,8 0,-30) 250 CALL LINK("CLEAR") 260 FOR I=1 TO 3 270 CALL LLL :: CALL LINK("T URN",60):: NEXT I 280 REM 290 REM 300 CALL XT 310 SUB LLL 320 CALL F(15) 330 CALL T(60) 340 CALL F(100) 350 CALL T(120) 360 CALL F(85) 370 CALL T(120) 380 CALL F(15) 390 CALL T(60) 400 CALL F(55) 410 CALL T(-120) 420 CALL F(85) 430 CALL T(120) 440 CALL F(15) 450 CALL T(60) 460 CALL F(100) 470 SUBEND 480 SUB F(X) 490 CALL LINK("FWD",X):: SUB END 500 SUB T(X) 510 CALL LINK("TURN",X):: SU BEND 520 SUB XT 530 CALL LINK("PRINT",178,20 ,"ANY KEY ") 540 CALL KEY(5,A,B) 550 IF B<1 THEN 540 560 IF A=82 THEN RUN 570 IF A<>65 THEN 540 580 CALL LINK("INPUT",178,20 ,A$,14,"DSK1.PICTURE") 590 CALL LINK("PRINT",178,20 ,"' ") 600 CALL LINK("SAVEP",A$) 610 GOTO 530 620 SUBEND
[ TI Book front page |
TI Resources Page
| PC99 Review
| PC99 Programs
]