Home » Personal collection » Acorn ADFS disks » Electron » Acornsoft_Educational.ADF » Me+MyMicro/TWISTER

Me+MyMicro/TWISTER

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn ADFS disks » Electron » Acornsoft_Educational.ADF
Filename: Me+MyMicro/TWISTER
Read OK:
File size: 06E6 bytes
Load address: FFFF1B00
Exec address: FFFF8023
File contents
   10 REM     ...Twister...
   20 
   30 REM      ...Electron Version 1...
   40 
   50 REM Copyright (c) Acornsoft 1984
   60 
   70 REM Initialise variables
   80 tries=0
   90 a$="123456789"
  100 c$=a$
  110 MODE 1
  120 VDU19,1,4,0,0,0
  130 
  140 PROCinstructions
  150 
  160 REM Shuffle routine
  170 j$=""
  180 REPEAT
  190  l=LEN a$
  200  n=RND(l)
  210  j$=j$+MID$(a$,n,1)
  220  a$=LEFT$(a$,n-1)+RIGHT$(a$,LEN(a$)-n)
  230 UNTIL LEN a$=0
  240 PRINT:PRINT
  250 REM is it in order already ?
  260 IF j$=c$ THEN 550
  270 
  280 REM Twister routine
  290 x=1:y=4:oldx=x:oldy=y:oldj$=j$
  300 REPEAT
  310  COLOUR 2:COLOUR128
  320  PRINT TAB(oldx,oldy);oldj$
  330  COLOUR 131:COLOUR 1
  340  PRINT TAB(x,y);j$
  350  COLOUR 2:COLOUR128
  360  l$=""
  370  REM not in order, so twist
  380  REPEAT PRINT TAB(22,16);"Twist how many                                          ";
  390  INPUT TAB(37,16);k
  400  UNTIL k>0 AND k<10
  410  PRINT TAB(37,16);"   ";
  420  tries=tries+1:oldy=y:oldx=x:oldj$=j$
  430  y=y+2
  440  IF y>28 y=4:x=x+10:IF x>12 CLS:PRINT'''"Perhaps you are becoming confused,"''"why not start again? (press any key)":G=GET:GOTO 70
  450  REM twist first few
  460  FOR a=k TO 1 STEP -1
  470   l$=l$+MID$(j$,a,1)
  480  NEXTa
  490  REM Leave final ones
  500  l$=l$+RIGHT$(j$,LEN(j$)-k)
  510  j$=l$
  520 UNTIL j$=c$
  530 
  540 REM Success
  550 COLOUR1:COLOUR130
  560 PRINT TAB(22,16);"    ";j$;"     "
  570 COLOUR2:COLOUR128
  580 PRINT TAB(22,20);"You succeeded in";TAB(22,21);tries;" tries"
  590 FORn=1 TO 20
  600  VDU19,RND(16)-1,RND(16)-1,0,0,0
  610  SOUND1,-15,n*8,2
  620 NEXT n:VDU 20
  630 
  640 PRINT TAB(22,24);"Do you want to";TAB(22,25);"play again (Y/N) ?";
  650 REPEAT:g=INSTR("YyNn",GET$)
  660 UNTIL g<>0
  670 IF g<3 THEN GOTO 80
  680 MODE 6:PRINT''''
  690 END
  700 
  710DEF PROCinstructions
  720 COLOUR 2:VDU12
  730 PRINT TAB(10,2);"T W I S T E R"'''"The object is to arrange the nine"'"shuffled numbers into ""123456789"" by"'"twisting a block of them starting from"'"the left. For example :"
  740 PRINT '"432156789"''"TWIST 4 gives"''"123456789-   CORRECT"
  750 PRINT TAB(0,20);"Press a key when you're ready ":key=GET
  760 CLS:PRINT TAB(10,2);"T W I S T E R"
  770 ENDPROC

 �     ...Twister...
 
$ �      ...Electron Version 1...
( 
2# � Copyright (c) Acornsoft 1984
< 
F � Initialise variables
P tries=0
Z a$="123456789"
d
 c$=a$
n � 1
x �19,1,4,0,0,0
� 
� �instructions
� 
� � Shuffle routine
�
 j$=""
� �
�  l=� a$
�  n=�(l)
�  j$=j$+�a$,n,1)
�  a$=�a$,n-1)+�a$,�(a$)-n)
�
 � � a$=0
� �:�
� � is it in order already ?
 � j$=c$ � �TfB
 
 � Twister routine
"# x=1:y=4:oldx=x:oldy=y:oldj$=j$
, �
6  � 2:�128
@  � �oldx,oldy);oldj$
J  � 131:� 1
T  � �x,y);j$
^  � 2:�128
h  l$=""
r  � not in order, so twist
|M  � � �22,16);"Twist how many                                          ";
�  � �37,16);k
�  � k>0 � k<10
�  � �37,16);"   ";
�*  tries=tries+1:oldy=y:oldx=x:oldj$=j$
�  y=y+2
�|  � y>28 y=4:x=x+10:� x>12 �:�'''"Perhaps you are becoming confused,"''"why not start again? (press any key)":G=�:� �DF@
�  � twist first few
�  � a=k � 1 � -1
�   l$=l$+�j$,a,1)
�  �a
�  � Leave final ones
�  l$=l$+�j$,�(j$)-k)
�  j$=l$
 � j$=c$
 
 � Success
& �1:�130
0  � �22,16);"    ";j$;"     "
: �2:�128
D8 � �22,20);"You succeeded in";�22,21);tries;" tries"
N �n=1 � 20
X  �19,�(16)-1,�(16)-1,0,0,0
b  �1,-15,n*8,2
l
 � n:� 20
v 
�= � �22,24);"Do you want to";�22,25);"play again (Y/N) ?";
� �:g=�"YyNn",�)
� � g<>0
� � g<3 � � �DP@
� � 6:�''''
� �
� 
�� �instructions
� � 2:�12
گ � �10,2);"T W I S T E R"'''"The object is to arrange the nine"'"shuffled numbers into ""123456789"" by"'"twisting a block of them starting from"'"the left. For example :"
�< � '"432156789"''"TWIST 4 gives"''"123456789-   CORRECT"
�4 � �0,20);"Press a key when you're ready ":key=�
� �:� �10,2);"T W I S T E R"
 �
�
00000000  0d 00 0a 18 20 f4 20 20  20 20 20 2e 2e 2e 54 77  |.... .     ...Tw|
00000010  69 73 74 65 72 2e 2e 2e  0d 00 14 05 20 0d 00 1e  |ister....... ...|
00000020  24 20 f4 20 20 20 20 20  20 2e 2e 2e 45 6c 65 63  |$ .      ...Elec|
00000030  74 72 6f 6e 20 56 65 72  73 69 6f 6e 20 31 2e 2e  |tron Version 1..|
00000040  2e 0d 00 28 05 20 0d 00  32 23 20 f4 20 43 6f 70  |...(. ..2# . Cop|
00000050  79 72 69 67 68 74 20 28  63 29 20 41 63 6f 72 6e  |yright (c) Acorn|
00000060  73 6f 66 74 20 31 39 38  34 0d 00 3c 05 20 0d 00  |soft 1984..<. ..|
00000070  46 1b 20 f4 20 49 6e 69  74 69 61 6c 69 73 65 20  |F. . Initialise |
00000080  76 61 72 69 61 62 6c 65  73 0d 00 50 0c 20 74 72  |variables..P. tr|
00000090  69 65 73 3d 30 0d 00 5a  13 20 61 24 3d 22 31 32  |ies=0..Z. a$="12|
000000a0  33 34 35 36 37 38 39 22  0d 00 64 0a 20 63 24 3d  |3456789"..d. c$=|
000000b0  61 24 0d 00 6e 08 20 eb  20 31 0d 00 78 12 20 ef  |a$..n. . 1..x. .|
000000c0  31 39 2c 31 2c 34 2c 30  2c 30 2c 30 0d 00 82 05  |19,1,4,0,0,0....|
000000d0  20 0d 00 8c 12 20 f2 69  6e 73 74 72 75 63 74 69  | .... .instructi|
000000e0  6f 6e 73 0d 00 96 05 20  0d 00 a0 16 20 f4 20 53  |ons.... .... . S|
000000f0  68 75 66 66 6c 65 20 72  6f 75 74 69 6e 65 0d 00  |huffle routine..|
00000100  aa 0a 20 6a 24 3d 22 22  0d 00 b4 06 20 f5 0d 00  |.. j$="".... ...|
00000110  be 0c 20 20 6c 3d a9 20  61 24 0d 00 c8 0c 20 20  |..  l=. a$....  |
00000120  6e 3d b3 28 6c 29 0d 00  d2 14 20 20 6a 24 3d 6a  |n=.(l)....  j$=j|
00000130  24 2b c1 61 24 2c 6e 2c  31 29 0d 00 dc 1e 20 20  |$+.a$,n,1)....  |
00000140  61 24 3d c0 61 24 2c 6e  2d 31 29 2b c2 61 24 2c  |a$=.a$,n-1)+.a$,|
00000150  a9 28 61 24 29 2d 6e 29  0d 00 e6 0d 20 fd 20 a9  |.(a$)-n).... . .|
00000160  20 61 24 3d 30 0d 00 f0  08 20 f1 3a f1 0d 00 fa  | a$=0.... .:....|
00000170  1f 20 f4 20 69 73 20 69  74 20 69 6e 20 6f 72 64  |. . is it in ord|
00000180  65 72 20 61 6c 72 65 61  64 79 20 3f 0d 01 04 13  |er already ?....|
00000190  20 e7 20 6a 24 3d 63 24  20 8c 20 8d 54 66 42 0d  | . j$=c$ . .TfB.|
000001a0  01 0e 05 20 0d 01 18 16  20 f4 20 54 77 69 73 74  |... .... . Twist|
000001b0  65 72 20 72 6f 75 74 69  6e 65 0d 01 22 23 20 78  |er routine.."# x|
000001c0  3d 31 3a 79 3d 34 3a 6f  6c 64 78 3d 78 3a 6f 6c  |=1:y=4:oldx=x:ol|
000001d0  64 79 3d 79 3a 6f 6c 64  6a 24 3d 6a 24 0d 01 2c  |dy=y:oldj$=j$..,|
000001e0  06 20 f5 0d 01 36 0e 20  20 fb 20 32 3a fb 31 32  |. ...6.  . 2:.12|
000001f0  38 0d 01 40 19 20 20 f1  20 8a 6f 6c 64 78 2c 6f  |8..@.  . .oldx,o|
00000200  6c 64 79 29 3b 6f 6c 64  6a 24 0d 01 4a 0f 20 20  |ldy);oldj$..J.  |
00000210  fb 20 31 33 31 3a fb 20  31 0d 01 54 10 20 20 f1  |. 131:. 1..T.  .|
00000220  20 8a 78 2c 79 29 3b 6a  24 0d 01 5e 0e 20 20 fb  | .x,y);j$..^.  .|
00000230  20 32 3a fb 31 32 38 0d  01 68 0b 20 20 6c 24 3d  | 2:.128..h.  l$=|
00000240  22 22 0d 01 72 1e 20 20  f4 20 6e 6f 74 20 69 6e  |""..r.  . not in|
00000250  20 6f 72 64 65 72 2c 20  73 6f 20 74 77 69 73 74  | order, so twist|
00000260  0d 01 7c 4d 20 20 f5 20  f1 20 8a 32 32 2c 31 36  |..|M  . . .22,16|
00000270  29 3b 22 54 77 69 73 74  20 68 6f 77 20 6d 61 6e  |);"Twist how man|
00000280  79 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |y               |
00000290  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000002a0  20 20 20 20 20 20 20 20  20 20 20 22 3b 0d 01 86  |           ";...|
000002b0  11 20 20 e8 20 8a 33 37  2c 31 36 29 3b 6b 0d 01  |.  . .37,16);k..|
000002c0  90 12 20 20 fd 20 6b 3e  30 20 80 20 6b 3c 31 30  |..  . k>0 . k<10|
000002d0  0d 01 9a 16 20 20 f1 20  8a 33 37 2c 31 36 29 3b  |....  . .37,16);|
000002e0  22 20 20 20 22 3b 0d 01  a4 2a 20 20 74 72 69 65  |"   ";...*  trie|
000002f0  73 3d 74 72 69 65 73 2b  31 3a 6f 6c 64 79 3d 79  |s=tries+1:oldy=y|
00000300  3a 6f 6c 64 78 3d 78 3a  6f 6c 64 6a 24 3d 6a 24  |:oldx=x:oldj$=j$|
00000310  0d 01 ae 0b 20 20 79 3d  79 2b 32 0d 01 b8 7c 20  |....  y=y+2...| |
00000320  20 e7 20 79 3e 32 38 20  79 3d 34 3a 78 3d 78 2b  | . y>28 y=4:x=x+|
00000330  31 30 3a e7 20 78 3e 31  32 20 db 3a f1 27 27 27  |10:. x>12 .:.'''|
00000340  22 50 65 72 68 61 70 73  20 79 6f 75 20 61 72 65  |"Perhaps you are|
00000350  20 62 65 63 6f 6d 69 6e  67 20 63 6f 6e 66 75 73  | becoming confus|
00000360  65 64 2c 22 27 27 22 77  68 79 20 6e 6f 74 20 73  |ed,"''"why not s|
00000370  74 61 72 74 20 61 67 61  69 6e 3f 20 28 70 72 65  |tart again? (pre|
00000380  73 73 20 61 6e 79 20 6b  65 79 29 22 3a 47 3d a5  |ss any key)":G=.|
00000390  3a e5 20 8d 44 46 40 0d  01 c2 17 20 20 f4 20 74  |:. .DF@....  . t|
000003a0  77 69 73 74 20 66 69 72  73 74 20 66 65 77 0d 01  |wist first few..|
000003b0  cc 14 20 20 e3 20 61 3d  6b 20 b8 20 31 20 88 20  |..  . a=k . 1 . |
000003c0  2d 31 0d 01 d6 15 20 20  20 6c 24 3d 6c 24 2b c1  |-1....   l$=l$+.|
000003d0  6a 24 2c 61 2c 31 29 0d  01 e0 08 20 20 ed 61 0d  |j$,a,1)....  .a.|
000003e0  01 ea 18 20 20 f4 20 4c  65 61 76 65 20 66 69 6e  |...  . Leave fin|
000003f0  61 6c 20 6f 6e 65 73 0d  01 f4 18 20 20 6c 24 3d  |al ones....  l$=|
00000400  6c 24 2b c2 6a 24 2c a9  28 6a 24 29 2d 6b 29 0d  |l$+.j$,.(j$)-k).|
00000410  01 fe 0b 20 20 6a 24 3d  6c 24 0d 02 08 0c 20 fd  |...  j$=l$.... .|
00000420  20 6a 24 3d 63 24 0d 02  12 05 20 0d 02 1c 0e 20  | j$=c$.... .... |
00000430  f4 20 53 75 63 63 65 73  73 0d 02 26 0c 20 fb 31  |. Success..&. .1|
00000440  3a fb 31 33 30 0d 02 30  20 20 f1 20 8a 32 32 2c  |:.130..0  . .22,|
00000450  31 36 29 3b 22 20 20 20  20 22 3b 6a 24 3b 22 20  |16);"    ";j$;" |
00000460  20 20 20 20 22 0d 02 3a  0c 20 fb 32 3a fb 31 32  |    "..:. .2:.12|
00000470  38 0d 02 44 38 20 f1 20  8a 32 32 2c 32 30 29 3b  |8..D8 . .22,20);|
00000480  22 59 6f 75 20 73 75 63  63 65 65 64 65 64 20 69  |"You succeeded i|
00000490  6e 22 3b 8a 32 32 2c 32  31 29 3b 74 72 69 65 73  |n";.22,21);tries|
000004a0  3b 22 20 74 72 69 65 73  22 0d 02 4e 0e 20 e3 6e  |;" tries"..N. .n|
000004b0  3d 31 20 b8 20 32 30 0d  02 58 1f 20 20 ef 31 39  |=1 . 20..X.  .19|
000004c0  2c b3 28 31 36 29 2d 31  2c b3 28 31 36 29 2d 31  |,.(16)-1,.(16)-1|
000004d0  2c 30 2c 30 2c 30 0d 02  62 12 20 20 d4 31 2c 2d  |,0,0,0..b.  .1,-|
000004e0  31 35 2c 6e 2a 38 2c 32  0d 02 6c 0d 20 ed 20 6e  |15,n*8,2..l. . n|
000004f0  3a ef 20 32 30 0d 02 76  05 20 0d 02 80 3d 20 f1  |:. 20..v. ...= .|
00000500  20 8a 32 32 2c 32 34 29  3b 22 44 6f 20 79 6f 75  | .22,24);"Do you|
00000510  20 77 61 6e 74 20 74 6f  22 3b 8a 32 32 2c 32 35  | want to";.22,25|
00000520  29 3b 22 70 6c 61 79 20  61 67 61 69 6e 20 28 59  |);"play again (Y|
00000530  2f 4e 29 20 3f 22 3b 0d  02 8a 13 20 f5 3a 67 3d  |/N) ?";.... .:g=|
00000540  a7 22 59 79 4e 6e 22 2c  be 29 0d 02 94 0b 20 fd  |."YyNn",.).... .|
00000550  20 67 3c 3e 30 0d 02 9e  13 20 e7 20 67 3c 33 20  | g<>0.... . g<3 |
00000560  8c 20 e5 20 8d 44 50 40  0d 02 a8 0e 20 eb 20 36  |. . .DP@.... . 6|
00000570  3a f1 27 27 27 27 0d 02  b2 06 20 e0 0d 02 bc 05  |:.''''.... .....|
00000580  20 0d 02 c6 13 dd 20 f2  69 6e 73 74 72 75 63 74  | ..... .instruct|
00000590  69 6f 6e 73 0d 02 d0 0c  20 fb 20 32 3a ef 31 32  |ions.... . 2:.12|
000005a0  0d 02 da af 20 f1 20 8a  31 30 2c 32 29 3b 22 54  |.... . .10,2);"T|
000005b0  20 57 20 49 20 53 20 54  20 45 20 52 22 27 27 27  | W I S T E R"'''|
000005c0  22 54 68 65 20 6f 62 6a  65 63 74 20 69 73 20 74  |"The object is t|
000005d0  6f 20 61 72 72 61 6e 67  65 20 74 68 65 20 6e 69  |o arrange the ni|
000005e0  6e 65 22 27 22 73 68 75  66 66 6c 65 64 20 6e 75  |ne"'"shuffled nu|
000005f0  6d 62 65 72 73 20 69 6e  74 6f 20 22 22 31 32 33  |mbers into ""123|
00000600  34 35 36 37 38 39 22 22  20 62 79 22 27 22 74 77  |456789"" by"'"tw|
00000610  69 73 74 69 6e 67 20 61  20 62 6c 6f 63 6b 20 6f  |isting a block o|
00000620  66 20 74 68 65 6d 20 73  74 61 72 74 69 6e 67 20  |f them starting |
00000630  66 72 6f 6d 22 27 22 74  68 65 20 6c 65 66 74 2e  |from"'"the left.|
00000640  20 46 6f 72 20 65 78 61  6d 70 6c 65 20 3a 22 0d  | For example :".|
00000650  02 e4 3c 20 f1 20 27 22  34 33 32 31 35 36 37 38  |..< . '"43215678|
00000660  39 22 27 27 22 54 57 49  53 54 20 34 20 67 69 76  |9"''"TWIST 4 giv|
00000670  65 73 22 27 27 22 31 32  33 34 35 36 37 38 39 2d  |es"''"123456789-|
00000680  20 20 20 43 4f 52 52 45  43 54 22 0d 02 ee 34 20  |   CORRECT"...4 |
00000690  f1 20 8a 30 2c 32 30 29  3b 22 50 72 65 73 73 20  |. .0,20);"Press |
000006a0  61 20 6b 65 79 20 77 68  65 6e 20 79 6f 75 27 72  |a key when you'r|
000006b0  65 20 72 65 61 64 79 20  22 3a 6b 65 79 3d a5 0d  |e ready ":key=..|
000006c0  02 f8 1f 20 db 3a f1 20  8a 31 30 2c 32 29 3b 22  |... .:. .10,2);"|
000006d0  54 20 57 20 49 20 53 20  54 20 45 20 52 22 0d 03  |T W I S T E R"..|
000006e0  02 06 20 e1 0d ff                                 |.. ...|
000006e6
Me+MyMicro/TWISTER.m0
Me+MyMicro/TWISTER.m1
Me+MyMicro/TWISTER.m2
Me+MyMicro/TWISTER.m4
Me+MyMicro/TWISTER.m5