15

Series


If we examine the number series 1,2,3,4,5,6 we can confidently predict that the next in line will be 7. What have we done? We have looked at the interval between the first number and the second number and noted that it is 1. We have also looked at the next interval and noted that that too is 1. From that we hypothesise that all intervals will be 1. We go along the line checking this hypothesis and on finding it to be true, we extrapolate. We add 1 to the last, making 7.
   Now consider 2,3,5,7,12,17 - what will be next? The first interval is 1; the second interval is 2. Mmmmm - perhaps the interval increases by 1 each time? Checking, we see that it does. The last interval is 5, so the next will be 6, making the next number in the series 23.
   What about 78,9,77,10,76,11,75? Here it does not take much observation to see that there are two series interleaved; one going down; the other going up. Such series are often difficult to spot, as in 3,7,6,4,8,1,9, which again has two interleaved series. One decreases by 3 every time, while the other proceeds on a decaying increment - 3,6,8,9 - and will continue 9,8,6,3,-1.
   When we turn to letters the same holds true, as in B,D,F,G,I or W,V,T,Q,M - the next are K and H respectively. In the case of letters however, the alphabet does not go on indefinitely in both directions, so there must be a wrap-around at each end, which is to say that A and Z are considered to be adjacent.
   Now a computer program designed to produce series would not be very successful if it turned out only one or two types. Users would apply simple rules or tests and rapidly decipher the series. Not much fun there! However, fun and puzzling increase rapidly if a number of different types of series is available, as in the program listed. The user has a choice of numbers or letters; although the latter offer fewer types of series, most people find them more difficult. I won't explain the series types any further, but will leave you the opportunity to enjoy puzzling them out for yourself. Suffice to say that some series expect you to forecast only one number or letter, while some expect two. If your guess(es) are wrong, the computer will tell you what the answer should have been - and even then it is guaranteed that sometimes you will remain puzzled. Enjoy yourself!
   The puzzle series is printed in white on a dark blue background, and if you are correct, a flashing 'RIGHT!' appears, with your score so far. If you are wrong, or press RETURN without an input, a 'WRONG' message appears, together with the answer. You are given ten problems and then a percentage score. If you elect to play again, totals and percentages are carried over to another ten problems.

Variables

R$String to print to start a line in red
B$Ditto in blue
R%Record of correct answers
ALL%Total number of problems attempted
G%User's choice, 1 or 2
D%Difficulty level
PROB%Number of current problem
T%Major type of series
A,B,C,D,E,FUsed for creation of different series
Z%Numeric value of input guess
I%,J%Ditto for twin inputs

   10 R$=CHR$129+CHR$157+CHR$135
   20 B$=CHR$132+CHR$157+CHR$135
   30 R%=0:ALL%=10
   40 MODE7:PROCDBL(12,2,"SERIES"):PRINTTAB(13);"______"''
   50 PRINT'"Do you want -"TAB(5,12);R$;TAB(30);CHR$156
   60 PRINTTAB(5,13);R$;"(1) Numbers   ";CHR$156
   70 PRINTTAB(5,14);R$;"(2) Letters   ";CHR$156
   80 PRINTTAB(5,15);R$;"              ";CHR$156
   90 PRINT'''CHR$131;"Your choice.....?";
  100 REPEAT:G%=GET-48:UNTIL G%=1 OR G%=2
  110 PRINTG%:IF G%=2 D%=0:GOTO150
  120 PRINT''"How difficult?  Choose a number"''
  130 PRINT"from 1 (easy) to 4 (hard)...";
  140 REPEAT:D%=GET:UNTIL D%>48 AND D%<54:D%=D%-48:PRINT;D%
  150 FOR PROB%=1TO10:PROCNUM:CLS:PRINT'''
  160 ON G% GOTO170,310
  170 T%=RND(D%+3)
  180 ON T%GOSUB460,500,550,590,610,660,730
  190 NEXT
  200 MODE7:PRINTTAB(0,3);R$'R$"        S C O R E"
  210 PRINTR$;"        _________"
  220 PRINTR$"You scored ";R%;" out of ";ALL%
  230 PRINTR$"(or ";R%*100/ALL%;"%)"
  240 PRINTR$R$'''"Do you want to play again (Y-N)?"
  250 REPEAT:G$=GET$:UNTIL G$="Y" OR G$="N"
  260 IFG$="Y"CLS:ALL%=ALL%+10:GOTO40
  270 PRINTR$'R$"  G O O D B Y E"'R$:END
  280  
  290 REM - LETTERS
  300  
  310 IFA=0 A=26
  320 IFB=0 B=1
  330 ONRND(3)GOTO340,370,400
  340 PRINTB$;:FOR X%=1 TO 6:PRINT;CHR$(A+64);"  ";
  350 A=(A+B):A=A MOD 26:IF A=0 A=26
  360 NEXT:PROCKID(A):GOTO190
  370 PRINTB$;:FOR X%=1 TO 6:PRINT;CHR$(A+64);"  ";
  380 A=(A-B):IF A<=0 A=26+A
  390 NEXT:PROCKID(A):GOTO190
  400 PRINTB$;:FOR X%=1 TO 6:PRINT;CHR$(A+64);"  ";
  410 A=A+B:B=B+1:A=A MOD 26:IF A=0 A=26
  420 NEXT:PROCKID(A):GOTO340
  430  
  440 REM - NUMBERS
  450  
  460 PRINT;B$;:FOR X%=1 TO 6
  470 PRINT;B+X%*A;"  ";:NEXT
  480 PROCKID(7*A+B)
  490 RETURN
  500 IF RND(1)>.5 C=1 ELSE C=-1
  510 PRINT;B$;:FOR X=1 TO 6
  520 PRINT;B;"  ";:B=B+A:A=A+C:NEXT
  530 PROCKID(B)
  540 RETURN
  550 PRINT;B$;:FOR X%=1 TO 4
  560 PRINT;A+X%*C;"  ";B+X%*D;"  ";:NEXT
  570 PROCMORE(A+5*C,B+5*D)
  580 RETURN
  590 D=-D:GOTO550
  600 RETURN
  610 I%=RND(7)
  620 PRINT;B$;:FOR X%=1 TO 4
  630 PRINT;A;" ";B;" ";C;" ";:A=A+I%:B=B+I%:C=C+I%
  640 NEXT:PROCMORE(A,B)
  650 RETURN
  660 IF RND(1)>.5 E=1 ELSE E=-1
  670 IF RND(1)>.5 F=1 ELSE F=-1
  680 PRINT;B$;:FOR X%=1 TO 5
  690 PRINT;A;" ";B;" ";
  700 A=A+C:B=B+D:C=C+E:D=D+F:NEXT
  710 PROCMORE(A,B)
  720 RETURN
  730 ON RND(3) GOTO 740,770,810
  740 A=RND(4):PRINT;B$;:FOR X%=1 TO 5
  750 PRINT;A;"  ";:A=A*2:NEXT:PROCKID(A)
  760 RETURN
  770 A=RND(6):PRINT;B$;:FOR X%=1 TO 5
  780 PRINT;A*A;"  ";:A=A+1:NEXT:PROCKID(A*A)
  790 RETURN
  800 REM - SUMS
  810 PRINT;B$;:FOR X%=1 TO 5
  820 PRINT;A;" ";:C=A:A=B:B=A+C:NEXT:PROCKID(A)
  830 RETURN
  840  
  850 DEFPROCRT
  860 R%=R%+1:PRINT''B$
  870 PRINT;B$;CHR$136;"R I G H T !  (Your score=";R%;")"
  880 PRINT B$
  890 ENDPROC
  900  
  910 DEFPROCWRONG(Q%)
  920 PRINT''R$
  930 PRINTR$;"SORRY - THAT IS NOT RIGHT"
  940 PRINTR$
  950 PRINTR$;"THE CORRECT ANSWER IS ";
  960 IF G%=1 PRINT Q% ELSE PRINT CHR$(Q%+64)
  970 PRINTR$
  980 ENDPROC
  990  
 1000 DEFPROCNUM
 1010 A=RND(10+D%)-7:B=RND(10+D%)-7:C=RND(10+D%)-7:
      D=RND(10+D%)-7
 1020 IF D%<=2 A=ABS(A):B=ABS(B):C=ABS(B):D=ABS(D)
 1030 ENDPROC
 1040  
 1050 DEFPROCKID(Q%)
 1060 PRINT'''CHR$131;"What comes next?....";:INPUT Z$
 1070 IF G%=2 Z%=ASC(Z$)-64 ELSE Z%=VAL(Z$)
 1080 IF Z%=Q% PROCRT:GOTO1100
 1090 PROCWRONG(Q%)
 1100 PROCRET:ENDPROC
 1110  
 1120 DEFPROCRET
 1130 PRINT''CHR$129;"Press RETURN when ready....";
 1140 Q$=GET$:CLS:ENDPROC
 1150  
 1160 DEFPROCMORE(I%,J%)
 1170 PRINT'''CHR$131;"What comes next?....";:INPUT Z%
 1180 IF Z%<>I% PROCWRONG(I%):GOTO1210
 1190 PRINT''CHR$131;"And after that?...";:INPUT Z%
 1200 IF Z%<>J% PROCWRONG(J%) ELSE PROCRT
 1210 PROCRET:ENDPROC
 1220  
 1230 DEFPROCDBL(X%,Y%,X$)
 1240 PRINTTAB(X%,Y%);CHR$141;X$
 1250 PRINTTAB(X%,Y%+1);CHR$141;X$
 1260 ENDPROC