PATTERN PAIRS


If you have tried Odd One Out in this book, then you will find this following puzzle a little more difficult.

There are nine patterns displayed on the screen, in a range of colours, and you have only a few seconds to compare them and nominate the pair, you believe, are a match.

How to play

Identify your pair, note the numbers alongside and key in your answer. You don't have to key in your answer in strict chronological order. Just punch in your numbers and wait. Correct responses will be rewarded with a pleasant little high pitched tune, but wrong answers will be faced with a low pitched little dirge.

To continue, press Y for Yes and to stop, press N for No, remembering to press RETURN after your response.

A score sheet will appear at the end showing your tries, results, time and average time.

Programming hints

Each of the patterns is slightly different except for the matching pair. This is done by adding a mixture of H1, H2 and H3 to the corners of the triangles in procedure PROC_PATTERN and H1, H2 and H3 will be different for each pattern except the two that are the same.

If you wish to increase the number of patterns which are the same, then a W3 should be assigned. W3 should be a random number between 1 and 9 inclusive and you should check that it is not equal to W1 or W2. Then change W$ and W1$ and assign four more values, say, W2$, W3$, W4$ and W5$ with the string of W1, W2 and W3 arranged in all possible different ways.

Then check for PT to be equal to W1, W2 or W3 in line 720 in procedure PROC_PATTERN to see whether the pattern to be drawn is one of the three identical ones.

Change the input lines 440 to 510 to allow a third number to be keyed in and then check for the six possible values W$, W1$ to W5$.

   10 REM PATTERN PAIRS
   20 REM COPYRIGHT (C) G. LUDINSKI 1983
   30 DIM X(4,3),Y(4,3),C(4)
   40 MODE 5
   50 NU=0:CR=0
   60 TIME=0
   70 CLS
   80 NU=NU+1
   90 PT=0:PC=0
  100 REM
  110 REM DRAW FRAMEWORK
  120 REM
  130 GCOL0,2:COLOUR3
  140 MOVE426,255:DRAW426,1023
  150 MOVE852,255:DRAW852,1023
  160 MOVE0,255:DRAW1279,255
  170 MOVE0,510:DRAW1279,510
  180 MOVE0,765:DRAW1279,765
  190 REM
  200 REM GENERATE SHAPES
  210 REM
  220 W1=RND(9)
  230 W2=RND(9):IF W2=W1 THEN 230
  240 W$=STR$(W1)+STR$(W2)
  250 W1$=STR$(W2)+STR$(W1)
  260 FORI=1TO4
  270   C(I)=INT(RND(1)*3+1)
  280   FORJ=1TO3
  290     X(I,J)=INT(RND(1)*320+30)
  300     Y(I,J)=INT(RND(1)*160+30)
  310   NEXTJ
  320 NEXTI
  330 REM
  340 REM DRAW PATTERNS
  350 REM
  360 FORJ=765TO255STEP-255
  370   FORI=0TO852STEP426
  380     PROC_PATTERN(I,J)
  390   NEXTI
  400 NEXTJ
  410 REM
  420 REM QUESTION
  430 REM
  440 PRINTTAB(1,25)"Which two patterns 
    are the same":COLOUR1:PRINTTAB(6,27)
"?";:VDU19,1,1;0;19,2,3;0;19,3,7;0;
  450 I$="":I=0:IC=0
  460 I1$=INKEY$(0):IF I1$="" OR I1$<"1"
 OR I1$>"9" THEN 460
  470 PRINTI1$;:IF IC=0 THEN PRINT" and 
";
  480 IF IC=0 THEN IC=IC+1:I$=I$+I1$:GOT
O460
  490 I$=I$+I1$
  500 
  510 IF I$=W$ OR I$=W1$ THEN COLOUR2:PR
INT''" Yes, you're right!":SOUND1,-15,10
1,30:CR=CR+1:GOTO530
  520 PRINT:PRINT"No, ";LEFT$(W$,1);" an
d ";RIGHT$(W$,1);" are the same":SOUND1,
-15,73,10:SOUND1,-15,69,5
  530 PRINT:PRINT"Do you want more (Y/N)
";
  540 INPUT R$
  550 IF R$ <> "N" THEN GOTO 70
  560 REM
  570 REM SCORE SHEET
  580 REM
  590 CLS
  600 PRINT:PRINT"    Pattern Pairs"
  610 FORI=1TO9:PRINT:NEXTI
  620 PRINT:PRINT"Problems completed = "
;NU
  630 TM=INT(TIME/100)
  640 PRINT:PRINT"Problems correct = ";C
R
  650 PRINT:PRINT"Time taken = ";TM:PRIN
T"secs"
  660 IF CR<>0 THEN PRINT'"Time/problem 
= ";INT(TM/CR);" secs"
  670 GOTO 800
  680 :
  690 DEFPROC_PATTERN(XD,YD)
  700 PT=PT+1
  710 PRINTTAB(((20*XD)/1279)+1,31-(32*Y
D)/1023);PT
  720 IF PT=VAL(RIGHT$(W$,1)) OR PT=VAL(
LEFT$(W$,1)) THEN H1=80:H2=80:H3=80:GOTO
740
  730 PC=PC+1:H1=PC*10:H2=PC*10:H3=PC*10
  740 FORL=1TO4
  742   CL=RND(3):IF PT=VAL(RIGHT$(W$,1)
) OR PT=VAL(LEFT$(W$,1)) THEN CL=C(L)
  750   GCOL0,CL
  760   MOVE (X(L,1)+XD+H1),(Y(L,1)+YD+H
1)
  770   MOVE (X(L,2)+XD+H2),(Y(L,2)+YD+H
1)
  780   PLOT 85,(X(L,3)+XD+H3),(Y(L,3)+Y
D-INT(H1/2))
  790 NEXTL
  800 ENDPROC
  810 REM END