10 IF UNIT.TYPE=3 or unit.type>6 THEN PRINT "Super simon will not run on this machine because there is sound in this game.":END
20 ON ERROR GOTO 1910
30 DIM SN(8),S$(8),T$(4),NU(200),O(200)
40 DATA 233,293,348,466,588,696,932,1172
50 FOR I=1 TO 8:READ SN(I):NEXT
60 DATA "diminished","minor","major","augmented"
70 FOR I=1 TO 4:READ T$(I):NEXT
80 PRINT "welcome to super simon 1.3, programmed by Graham Pearce, inspired by a"
90 PRINT "version of simon by Gary Pearce, with ideas borrowed from other versions."
100 PRINT "do you want instructions"
110 I$=INKEY$:IF I$="" THEN 110
120 IF I$="y" THEN 1300
130 IF I$="n" THEN 150
140 PRINT "invalid response.":GOTO 100
150 SP=1:MI=3:T=3:LE=2:AR=1.3:NOTES=4:LR=1:M=3
160 IF LR=1 AND UNIT.TYPE=1 OR UNIT.TYPE=6 THEN S$(1)="s":S$(2)="d":S$(3)="f":S$(4)="k"
170 IF LR=1 AND UNIT.TYPE=0 or unit.type>1 AND UNIT.TYPE<6 THEN S$(1)="'":S$(2)="1":S$(3)="a":S$(4)=CHR$(34)
180 IF LR=2 AND UNIT.TYPE=1 OR UNIT.TYPE=6 THEN S$(1)="s":S$(2)="j":S$(3)="k":S$(4)="l"
190 IF LR=2 AND unit.type =0 or UNIT.TYPE>1 AND UNIT.TYPE<6 THEN S$(1)="1":S$(2)="`":S$(3)=CHR$(34):S$(4)=","
200 IF NOTES=6 AND UNIT.TYPE=1 OR UNIT.TYPE=6 THEN S$(1)="s":S$(2)="d":S$(3)="f":S$(4)="j":S$(5)="k":S$(6)="l"
210 IF NOTES=6 AND unit.type=0 or UNIT.TYPE>1 AND UNIT.TYPE <6 THEN S$(1)="'":S$(2)="1":S$(3)="a":S$(4)="`":S$(5)=CHR$(34):S$(6)=","
220 IF NOTES=8 THEN S$(1)="a":S$(2)="s":S$(3)="d":S$(4)="f":S$(5)="j":S$(6)="k":S$(7)="l":S$(8)=","
230 IF T=1 THEN SN(2)=277:SN(3)=330:SN(5)=554:SN(6)=660:SN(8)=1108
240 IF T=2 THEN SN(2)=277:SN(5)=554:SN(8)=1108
250 IF T=4 THEN SN(3)=370:SN(6)=740
260 PRINT "press 'n' to change the number of notes and their positions.","you can currently choose from",NOTES;" notes ",
270 IF LR=1 THEN PRINT "mostly in the left hand":GOTO 280 ELSE IF LR=2 THEN PRINT "mostly in the right hand":GOTO 280
280 PRINT "press 'm' to change the number of mistakes allowed during the game.","currently",MI;"mistakes will be allowed."
290 PRINT "press 's' to change the speed. at the moment, the speed is",SP
300 PRINT "press 'a' to change the acceleration rate. at the moment, the acceleration rate is",AR
310 PRINT "press 'p' to change the pause ratio. the pause ratio is currently",LE
320 PRINT "press 't' to change the tonality. the tonality is currently ",T$(T)
330 PRINT "press 'v' to save a configuration file."
340 PRINT "press 'l' to load a configuration file."
350 PRINT "press 'r' to go into practice mode."
360 PRINT "press 'b' to begin the game."
370 I$=INKEY$:IF I$="" THEN 370
380 IF I$="n" THEN 490
390 IF I$="m" THEN 570
400 IF I$="s" THEN 590
410 IF I$="a" THEN 610
420 IF I$="p" THEN 640
430 IF I$="t" THEN 700
440 IF I$="r" THEN 710
450 IF I$="v" THEN 1820
460 IF I$="l" THEN 1860
470 IF I$="b" THEN 820
480 PRINT "invalid response.":GOTO 370
490 PRINT "enter 1 if you want to have a choice of four notes, 2 if you want to have a"
500 PRINT "choice of 6, and 3 if you want to have a choice of 8.":INPUT "",CH
510 CH=ABS(FIX(CH)):IF CH<1 OR CH>3 THEN PRINT "must be between 1 and 3.":GOTO 490
520 IF CH=3 AND unit.type =0 or unit.type>1 or unit.type<6 THEN PRINT "only available on the type 'n speak.":GOTO 490
530 NOTES=CH*2+2
540 IF NOTES>4 THEN LR=0:GOTO 200
550 PRINT "press 1 if you want the notes mostly on your left hand, 2 if you want them":PRINT"mostly on your right.":INPUT "",LR
560 IF LR<1 OR LR>2 THEN PRINT "please type 1 or 2":GOTO 550 ELSE 160
570 PRINT "how many mistakes will I allow before the game is over? 0, 1, 2 or 3print ":INPUT "",MI:M=MI
580 IF M<0 OR M>3 THEN PRINT "only 0, 1, 2 or 3 mistakes will be allowed!":GOTO 570 ELSE 260
590 PRINT "enter the starting speed of the notes.":INPUT "",SP
600 SP=ABS(SP):IF SP<.5 OR SP>20 THEN PRINT "you've got to be joking!":GOTO 590 ELSE 260
610 PRINT "enter the acceleration rate between 1 and 2. 1 gives you no change in speed"
620 PRINT "during the game and 2 will give you the most change in speed.":INPUT "",AR
630 AR=ABS(AR):IF AR<1 OR AR>2 THEN PRINT "you've got to be joking!":GOTO 610 ELSE 260
640 PRINT "enter the pause ratio between 1.5 and 4."
650 PRINT "1.5 gives the most pause between rounds and 4 gives the least.":INPUT "",LE  
660 LE=ABS(LE):IF LE<1.5 OR LE>4 THEN PRINT "are you serious?":GOTO 640 ELSE 260
670 PRINT "press 1 if you would like the notes in a diminished tonality, 2 if you would"
680 PRINT "like them in a minor tonality, 3 if you would like them in a major tonality or 4"
690 PRINT "for an augmented tonality.":INPUT "",T
700 T=ABS(FIX(T)):IF T<1 OR T>4 THEN PRINT "please enter 1, 2, 3, or 4.":GOTO 670 ELSE 230
710 PRINT "practice mode active. to exit press escape or e-chord."
720 I$=INKEY$:IF I$="" THEN 720
730 FOR I=1 TO NOTES:IF I$=S$(I) THEN SOUND SN(I),3.296703/SP:Z=I:GOTO 740
740 NEXT
750 IF I$="%E" OR I$=CHR$(27) THEN 770
760 IF Z=0 THEN PRINT "not a symbol used in this game.":GOTO 720 ELSE Z=0:GOTO 720
770 PRINT "are you happy with the settings?"
780 I$=INKEY$:IF I$="" THEN 780
790 IF I$="y" THEN 820
800 IF I$="n" THEN 260
810 PRINT "invalid response.":GOTO 790
820 OP=SP:PRINT "press any key to start the game."
830 I$=INKEY$:IF I$="" THEN 830
840 TZ=(TIME.HOUR*3600)+(TIME.MIN*60)+TIME.SEC
850 Z=0:TR=0:SO=FIX(RND(1)*NOTES)+1:NU(S+1)=SN(SO):S=S+1:O(S)=SO
860 IF S>0 THEN SOUND 0,5/1.82/SP/LE
870 FOR I=1 TO S:SOUND 0,.05409:SOUND NU(I),3.296703/SP:NEXT:TM=(TIME.HOUR*3600)+(TIME.MIN*60)+TIME.SEC
880 TN=(TIME.HOUR*3600)+(TIME.MIN*60)+TIME.SEC:IF TM>TN THEN TN=TN+86400!
890 IF TN-TM >=3 THEN S=S-1:GOTO 970 ELSE 900
900 I$=INKEY$:IF I$="" THEN 880
910 FOR I=1 TO NOTES:IF I$=S$(I) THEN SOUND SN(I),3.296703/SP:Z=I:GOTO 920
920 NEXT
930 IF Z=0 THEN PRINT "not a symbol used in this game.":TM=(TIME.HOUR*3600)+(TIME.MIN*60)+TIME.SEC:GOTO 890
940 IF O(TR+1)=Z THEN TR=TR+1 ELSE GOTO 970
950 FOR I=1 TO S/2:IF TR=S AND S>3 AND 2^I =S THEN SP=SP*AR:GOTO 960 ELSE NEXT 
960 IF TR=S THEN Z=0:GOTO 850 ELSE TM=(TIME.HOUR*3600)+(TIME.MIN*60)+TIME.SEC:Z=0:GOTO 890
970 M=M-1:IF M=-1 THEN 1030
980 PRINT "you can make only"M+1"mistakes now before the game is over."
990 PRINT "press space to resume game.":
1000 I$=INKEY$:IF I$="" THEN 1000
1010 IF I$=" " THEN 1020 ELSE 1000
1020 TR=0:I$="":GOTO 860
1030 S=S-1:FOR I=130 TO 100 STEP -3:SOUND I,.5409:NEXT:SOUND 90,8.24175
1040 PRINT "YOU BLEW IT!"
1050 IF TM-TZ <0 THEN TM=TM+86400!
1060 IF S=0 THEN TM=0:TZ=0
1070 IF S=0 THEN AV=0 ELSEAV=(TM-TZ)/S
1080 PRINT "YOU COMPLETED",S"TONES CORRECTLY IN ",TM-TZ,"SECONDS, WITH AN AVERAGE TIME"
1090 print "PER TONE OF ",INT(AV*100+.5)/100," SECONDS."
1100 OPEN 1,"SIMON.REC"
1110 FINPUT 1,OT 1,OS, 1,OA
1120 IF S>OT THEN 1170
1130 IF S=0 THEN 1150
1140 IF S=OT AND OT/OA<S/(TM-TZ) THEN 1170
1150 PRINT "the current record is",OT,"tones completed in",OS,"seconds with an average time"
1160 PRINT "per tone of",OA;"seconds.":GOTO 1200
1170 CLOSE:PRINT "which sets a new record!"
1180 CREATE 1,"SIMON.REC":FPRINT 1,S, 1,TM-TZ, 1, INT(AV*100+.5)/100:CLOSE
1190 PRINT "the old record was when",OT;"tones were completed in",OS;"seconds with an average time per tone of",OA;"seconds."
1200 PRINT "do you want to play againprint "
1210 I$=INKEY$:IF I$="" THEN 1210
1220 IF I$<>"n" AND I$<>"y" THEN PRINT "INVALID RESPONSE.":GOTO 1200
1230 IF I$="y" THEN FOR I=1 TO S:NU(I)=0:O(I)=0:NEXT:S=0:M=MI:SP=OP:CLOSE:GOTO 1250
1240 IF I$="n" THEN PRINT "hope you had fun!":END
1250 PRINT "do you want to change any settings for the next game?"
1260 I$=INKEY$:IF I$="" THEN 1260
1270 IF I$="y" THEN 160
1280 IF I$="n" THEN 820
1290 PRINT "invalid response.":GOTO 1250
1300 PRINT "I will play one note, then you must copy it."
1310 PRINT "the objective of the game is to correctly copy as many tones as","you can."
1320 PRINT "after the instructions which you are reading now, the game will present a menu"
1330 PRINT "of choices.","the first choice will be the number of notes you want to choose from."
1340 PRINT "if you choose to have six, the keys to remember are s, d, f, j, k and l for the type 'n speak and type lite,"
1350 PRINT "or dot 3, dot 2, dot 1, dot 4, dot 5 or dot 6 for any other freedom scientific note taker."
1360 PRINT "if you choose to have eight tones and you are using a type 'n speak or type lite,the keys to remember are"
1370 PRINT "a, s, d, f, j, k, l and semi-colon."
1380 PRINT "This mode is not available in any other notetaker."
1390 PRINT "if you did not choose four tones, the game will take you back to the menu of","choices." 
1400 PRINT "if you choose to have four tones, the game will ask you if you want"
1410 PRINT "most of the tones on the left hand, or most of them on your right hand."
1420 PRINT "if you choose to have most of the tones on your left hand, the keys to press to activate the associated tones are"
1430 PRINT "s, d, f and k for the type 'n speak or type lite, or dot 3, dot 2, dot 1 and dot 5 for any other note-taker."
1440 PRINT "if you choose the right hand option, the keys to remember are"
1450 PRINT "s, j, k and l for the type 'n speak and type lite, or dot 2, dot 4, dot 5 and dot 6 for any other note taker."
1460 PRINT "press any key to continue."
1470 I$=INKEY$:IF I$="" THEN 1470
1480 PRINT "the next choice in the menu refers to  the","number of mistakes to be allowed before the game is over."
1490 PRINT "this prompt is pretty self-explanatory, but it is worth noting that hanging"
1500 PRINT "around while the game is in progress for more than three seconds is counted as a mistake."
1510 PRINT "the next choice in the menu is the speed at which the notes are played."
1520 PRINT "choose numbers between 0.5 and 20 here."
1530 PRINT "a speed of 0.5 is very slow, a speed of 1 is normal and a speed of 4 or 5 is","very fast."
1540 PRINT "how fast the speed increases is determined by the acceleration rate, see below."
1550 PRINT "press any key to continue."
1560 I$=INKEY$:IF I$="" THEN 1560
1570 PRINT "the next choice in the menu is the acceleration rate."
1580 PRINT "this refers to how fast the speed will increase."
1590 PRINT "a value of 1 means that the speed never increases during the game, and a value"
1600 PRINT "of 2 means it increases very quickly."
1610 PRINT "the default value is 1.3."
1620 PRINT "next, the game will ask you for a pause ratio."
1630 PRINT "this determines how long the game pauses after you have"
1640 PRINT "successfully typed in all the notes the computer has asked for."
1650 PRINT "if you are just starting with these kind of games, you should pick a value","between 1 and 2."
1660 PRINT "if you are an experienced simon player, you should probably pick a value between 3 and 4."
1670 PRINT "press any key to continue."
1680 I$=INKEY$:IF I$="" THEN 1680
1690 PRINT "The next menu choice is  the tonality you want the tones in, either diminished, minor, major or augmented."
1700 PRINT "for those who don't know or have forgotten,"
1710 PRINT "diminished is when you have a stack of minor 3rds on top of each other, giving a rather spooky sound."
1720 PRINT "a minor chord is when you have a minor 3rd then a major 3rd, making it sound","rather sad."
1730 PRINT "a major chord is when you have a major 3rd then a minor one, making it sound","quite bright."
1740 PRINT "and an augmented chord is a stack of major 3rds, making it sound pretty weird."
1750 PRINT "have a go at each one to see which one you prefer."
1760 PRINT "the rest of the game is self-explanatory, and besides, you need some surprises, grin."
1770 PRINT "do you want the instructions repeated?"
1780 I$=INKEY$:IF I$="" THEN 1780
1790 IF I$="y" THEN 1300
1800 IF I$="n" THEN 490
1810 PRINT "invalid response.":GOTO 1770
1820 AZ=1:PRINT "enter file name to store configuration file in. do not include a .cfg extention.":INPUT "",F$
1830 F$=F$".cfg":CREATE 1,F$ 
1840 OFF:FPRINT 1, NOTES, 1,LR, 1,MI, 1,SP, 1,AR, 1,LE, 1 T
1850 AZ=0:CLOSE:GOTO 260
1860 AZ=2:PRINT "enter the name of the configuration file to load. do not include the .cfg","extention":INPUT "",F$
1870 F$=F$".cfg"
1880 OFF:CREATE 1,F$
1890 FINPUT 1,NOTES, 1,LR, 1,MI, 1,SP, 1,AR, 1,LE, 1,T
1900 CLOSE:AZ=0:M=MI:GOTO 160
1910 IF ERR=53 AND S=0 AND AZ=0 THEN 1150
1920 IF ERR=12 AND AZ>0 THEN PRINT "file not found. please re-enter":GOTO 1860
1930 IF ERR=19 THEN PRINT "bad file name. please re-enter":IF AZ=1 THEN 1820 ELSE IF AZ=2 THEN 1860
1940 IF ERR=12 THEN 1170 ELSE PRINT "an error code",ERR;"has occurred. terminating ..."
