%Header Record Format:MCS1 Type Number:1 File Name:MORSE Option Name: Communication SW:0 Capacity:5881 Data Type:PG %Data Record Password: BaseN:0 0\->A~Z 3\->A \Lbl Z \ClrText "===== M O R S E =====" \Locate 9,3,"CODER" \Locate 8,4,"DECODER" \Locate 9,5,"TABLE" \Locate 9,6,"ABOUT" \Locate 8,7,"QUITTER" \While 1 \Locate 6,A," " \Locate 16,A," " A+(\Ans=37)-(\Ans=28)\->A A+5(A<3)-5(A>7)\->A \Locate 6,A,"-" \Locate 16,A,"-" \Do:\Getkey \LpWhile \Ans \Do:\Getkey \LpWhile \Ans=0 \Ans=31\=>\Break \WhileEnd \Do:\Getkey \LpWhile \Ans A=3\=>\Goto1 A=4\=>\GotoB A=5\=>\GotoY A=7\=>\GotoX \ClrText \Locate 7,2,"M O R S E" \Locate 3,4,"PAR 4THINK - 2012" \Locate 21,7,"\->" \Do:\Getkey \LpWhile \Ans=0 \GotoZ \Lbl X 0\->A~Z \ClrText \ClrMat M \Locate 6,4,"A BIENTOT!" \Stop \Lbl Y \ClrText "A:.- H:.... O:--- B:-... I:.. P:.--. C:-.-. J:.--- Q:--.- D:-.. K:-.- R:.-. E:. L:.-.. S:... F:..-. M:-- T:- G:--. N:-. U:..- \->" \Do:\Getkey \LpWhile \Ans=0 \ClrText "V:...-" "W:.--" "X:-..-" "Y:-.--" "Z:--.." \Locate 21,7,"\->" \Do:\Getkey \LpWhile \Ans=0 \ClrText "1:.---- 8:---.." "2:..--- 9:----." "3:...--" "4:....-" "5:....." "6:-...." "7:--..." \Locate 21,7,"\->" \Do:\Getkey \LpWhile \Ans=0 \GotoZ \Lbl B 0\->A~Z \ClrMat M {6,147}\->\Dim \Mat M 1\->X~Y 1\->A~B \ClrText \Do:\Getkey \LpWhile \Ans\<>0 \Lbl A \Do:\Getkey \Locate X,Y,"\->" \Locate X,Y," " \LpWhile \ Not \Ans \If \Ans=61:\Then 1\->\Mat M[A,B] \Locate X,Y,"." X+1\->X A+1\->A \IfEnd \If \Ans=32:\Then 2\->\Mat M[A,B] \Locate X,Y,"-" X+1\->X A+1\->A \IfEnd \If \Ans=47:\Then 0\->A~Z 4\->A \ClrMat M \GotoZ \IfEnd \If \Ans=33\ Or A>5\ Or \Ans=31 \Then Z+1\->Z 1\->A \Mat M[1,B]\->C \Mat M[2,B]\->D \Mat M[3,B]\->E \Mat M[4,B]\->F \Mat M[5,B]\->G \Ans=33\=>-1\->\Mat M[6,B] C=1\ And D=2\ And E=0\ And F=0\ And G=0\=>1\->\Mat M[6,B] C=2\ And D=1\ And E=1\ And F=1\ And G=0\=>2\->\Mat M[6,B] C=2\ And D=1\ And E=2\ And F=1\ And G=0\=>3\->\Mat M[6,B] C=2\ And D=1\ And E=1\ And F=0\ And G=0\=>4\->\Mat M[6,B] C=1\ And D=0\ And E=0\ And F=0\ And G=0\=>5\->\Mat M[6,B] C=1\ And D=1\ And E=2\ And F=1\ And G=0\=>6\->\Mat M[6,B] C=2\ And D=2\ And E=1\ And F=0\ And G=0\=>7\->\Mat M[6,B] C=1\ And D=1\ And E=1\ And F=1\ And G=0\=>8\->\Mat M[6,B] C=1\ And D=1\ And E=0\ And F=0\ And G=0\=>9\->\Mat M[6,B] C=1\ And D=2\ And E=2\ And F=2\ And G=0\=>10\->\Mat M[6,B] C=2\ And D=1\ And E=2\ And F=0\ And G=0\=>11\->\Mat M[6,B] C=1\ And D=2\ And E=1\ And F=1\ And G=0\=>12\->\Mat M[6,B] C=2\ And D=2\ And E=0\ And F=0\ And G=0\=>13\->\Mat M[6,B] C=2\ And D=1\ And E=0\ And F=0\ And G=0\=>14\->\Mat M[6,B] C=2\ And D=2\ And E=2\ And F=0\ And G=0\=>15\->\Mat M[6,B] C=1\ And D=2\ And E=2\ And F=1\ And G=0\=>16\->\Mat M[6,B] C=2\ And D=2\ And E=1\ And F=2\ And G=0\=>17\->\Mat M[6,B] C=1\ And D=2\ And E=1\ And F=0\ And G=0\=>18\->\Mat M[6,B] C=1\ And D=1\ And E=1\ And F=0\ And G=0\=>19\->\Mat M[6,B] C=2\ And D=0\ And E=0\ And F=0\ And G=0\=>20\->\Mat M[6,B] C=1\ And D=1\ And E=2\ And F=0\ And G=0\=>21\->\Mat M[6,B] C=1\ And D=1\ And E=1\ And F=2\ And G=0\=>22\->\Mat M[6,B] C=1\ And D=2\ And E=2\ And F=0\ And G=0\=>23\->\Mat M[6,B] C=2\ And D=1\ And E=1\ And F=2\ And G=0\=>24\->\Mat M[6,B] C=2\ And D=1\ And E=2\ And F=2\ And G=0\=>25\->\Mat M[6,B] C=2\ And D=2\ And E=1\ And F=1\ And G=0\=>26\->\Mat M[6,B] C=1\ And D=2\ And E=2\ And F=2\ And G=2\=>28\->\Mat M[6,B] C=1\ And D=1\ And E=2\ And F=2\ And G=2\=>29\->\Mat M[6,B] C=1\ And D=1\ And E=1\ And F=2\ And G=2\=>30\->\Mat M[6,B] C=1\ And D=1\ And E=1\ And F=1\ And G=2\=>31\->\Mat M[6,B] C=1\ And D=1\ And E=1\ And F=1\ And G=1\=>32\->\Mat M[6,B] C=2\ And D=1\ And E=1\ And F=1\ And G=1\=>33\->\Mat M[6,B] C=2\ And D=2\ And E=1\ And F=1\ And G=1\=>34\->\Mat M[6,B] C=2\ And D=2\ And E=2\ And F=1\ And G=1\=>35\->\Mat M[6,B] C=2\ And D=2\ And E=2\ And F=2\ And G=1\=>36\->\Mat M[6,B] C=2\ And D=2\ And E=2\ And F=2\ And G=2\=>27\->\Mat M[6,B] B+1\->B \Locate X,Y,"/" X+1\->X \IfEnd \Ans=31\=>\GotoC \If \Ans=44\ And (X>1\ Or Y>1) \Then \If A\<>1:\Then 1\->A Z+1\->Z B+1\->B X+1\->X \IfEnd B-1\->B Z-1\->Z \For 1\->M \To 6 \Mat M[M,B]=0\=>\Break \Next X-M\->X \If X\<=0\ And Y>1 \Then X+21\->X Y-1\->Y \IfEnd \For 0\->N \To 5 X+N\->O Y\->P \If O>21:\Then P+1\->P O-21\->O \IfEnd 0\->\Mat M[N+1,B] \Locate O,P," " \Next \(-)1\->\Mat M[6,B] \IfEnd \If X=22\ And Y<7 \Then 1\->X Y+1\->Y \IfEnd \Do:\Getkey \LpWhile \Ans X<22\=>\GotoA \Do:\Getkey \LpWhile \Ans\<>31\ And \Ans\<>44 \If \Ans=44 \Then 21\->X \Do:\Getkey \LpWhile \Ans \GotoA \IfEnd \GotoC \Lbl C 1\->I~J \ClrText \For 1\->U \To Z \Mat M[6,U]\->V V=0\=>\Locate I,J,"?" V=1\=>\Locate I,J,"A" V=2\=>\Locate I,J,"B" V=3\=>\Locate I,J,"C" V=4\=>\Locate I,J,"D" V=5\=>\Locate I,J,"E" V=6\=>\Locate I,J,"F" V=7\=>\Locate I,J,"G" V=8\=>\Locate I,J,"H" V=9\=>\Locate I,J,"I" V=10\=>\Locate I,J,"J" V=11\=>\Locate I,J,"K" V=12\=>\Locate I,J,"L" V=13\=>\Locate I,J,"M" V=14\=>\Locate I,J,"N" V=15\=>\Locate I,J,"O" V=16\=>\Locate I,J,"P" V=17\=>\Locate I,J,"Q" V=18\=>\Locate I,J,"R" V=19\=>\Locate I,J,"S" V=20\=>\Locate I,J,"T" V=21\=>\Locate I,J,"U" V=22\=>\Locate I,J,"V" V=23\=>\Locate I,J,"W" V=24\=>\Locate I,J,"X" V=25\=>\Locate I,J,"Y" V=26\=>\Locate I,J,"Z" V>26\=>\Locate I,J,V-27 V=\(-)1\=>\Locate I,J," " V=\(-)1\=>U>1\=>\Mat M[6,U-1]=\(-)1\=>\Locate I,J,"." I+1\->I V=\(-)1\ And \Mat M[6,U+1]=\(-)1\=>I-1\->I \If I=22 \Then 1\->I J+1\->J \IfEnd \Next \Locate 21,7,"\->" \Do:\Getkey \LpWhile \Ans=0 0\->A~Z 4\->A \ClrMat M \GotoZ \Lbl 1 0\->A~Z \ClrMat M {21,7}\->\Dim \Mat M 1\->X~Y \ClrText \Do:\Getkey \LpWhile \Ans\<>0 \Lbl 0 \Do:\Getkey \Locate X,Y,"\->" \Locate X,Y," " \LpWhile \ Not \Ans \If \Ans=47:\Then 0\->A~Z 3\->A \ClrMat M \GotoZ \IfEnd \Ans\->\Mat M[X,Y] \Ans-10(\Int (\Ans(10^-1)))\>=7\ Or \Ans=31\ Or \Ans=44\ Or \Ans=41\ Or \Ans=51\=>0\->\Mat M[X,Y] \Ans=71\=>\Locate X,Y,"Z" \Ans=72\=>\Locate X,Y,"U" \Ans=62\=>\Locate X,Y,"V" \Ans=52\=>\Locate X,Y,"W" \Ans=73\=>\Locate X,Y,"P" \Ans=63\=>\Locate X,Y,"Q" \Ans=53\=>\Locate X,Y,"R" \Ans=74\=>\Locate X,Y,"M" \Ans=64\=>\Locate X,Y,"N" \Ans=54\=>\Locate X,Y,"O" \Ans=42\=>\Locate X,Y,"X" \Ans=32\=>\Locate X,Y,"Y" \Ans=43\=>\Locate X,Y,"S" \Ans=33\=>\Locate X,Y,"T" \Ans=76\=>\Locate X,Y,"A" \Ans=66\=>\Locate X,Y,"B" \Ans=56\=>\Locate X,Y,"C" \Ans=46\=>\Locate X,Y,"D" \Ans=36\=>\Locate X,Y,"E" \Ans=26\=>\Locate X,Y,"F" \Ans=75\=>\Locate X,Y,"G" \Ans=65\=>\Locate X,Y,"H" \Ans=55\=>\Locate X,Y,"I" \Ans=45\=>\Locate X,Y,"J" \Ans=35\=>\Locate X,Y,"K" \Ans=25\=>\Locate X,Y,"L" \Ans=31\=>\Goto2 \If \Ans=44:\Then \Locate X,Y," " X-1\->X \If X=0\ And Y>1 \Then 21\->X Y-1\->Y \IfEnd X=0\ And Y=1\=>X+1\->X 0\->\Mat M[X,Y] \IfEnd \Mat M[X,Y]\<>0\=>X+1\->X \If X=22\ And Y<7 \Then 1\->X Y+1\->Y \IfEnd \Do:\Getkey \LpWhile \Ans X<22\=>\Goto0 \Do:\Getkey \LpWhile \Ans\<>31\ And \Ans\<>44 \If \Ans=44 \Then 21\->X \Do:\Getkey \LpWhile \Ans \Goto0 \IfEnd \Goto2 \Lbl 2 1\->I~J \ClrText \For 1\->V \To Y \For 1\->U \To 21 \If \Mat M[U,V]=76 \Then \If I+3>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,".-/" I+3\->I \IfEnd \If \Mat M[U,V]=55 \Then \If I+3>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"../" I+3\->I \IfEnd \If \Mat M[U,V]=64 \Then \If I+3>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"-./" I+3\->I \IfEnd \If \Mat M[U,V]=53 \Then \If I+4>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,".-./" I+4\->I \IfEnd \If \Mat M[U,V]=33 \Then \If I+2>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"-/" I+2\->I \IfEnd \If \Mat M[U,V]=72 \Then \If I+4>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"..-/" I+4\->I \IfEnd \If \Mat M[U,V]=62 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"...-/" I+5\->I \IfEnd \If \Mat M[U,V]=61 \Then \If I+1>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"/" I+1\->I \IfEnd \If \Mat M[U,V]=66 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"-.../" I+5\->I \IfEnd \If \Mat M[U,V]=56 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"-.-./" I+5\->I \IfEnd \If \Mat M[U,V]=46 \Then \If I+4>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"-../" I+4\->I \IfEnd \If \Mat M[U,V]=36 \Then \If I+2>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"./" I+2\->I \IfEnd \If \Mat M[U,V]=26 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"..-./" I+5\->I \IfEnd \If \Mat M[U,V]=75 \Then \If I+4>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"--./" I+4\->I \IfEnd \If \Mat M[U,V]=65 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"..../" I+5\->I \IfEnd \If \Mat M[U,V]=45 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,".---/" I+5\->I \IfEnd \If \Mat M[U,V]=35 \Then \If I+4>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"-.-/" I+4\->I \IfEnd \If \Mat M[U,V]=25 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,".-../" I+5\->I \IfEnd \If \Mat M[U,V]=74 \Then \If I+3>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"--/" I+3\->I \IfEnd \If \Mat M[U,V]=54 \Then \If I+4>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"---/" I+4\->I \IfEnd \If \Mat M[U,V]=73 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,".--./" I+5\->I \IfEnd \If \Mat M[U,V]=63 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"--.-/" I+5\->I \IfEnd \If \Mat M[U,V]=43 \Then \If I+4>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,".../" I+4\->I \IfEnd \If \Mat M[U,V]=52 \Then \If I+4>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,".--/" I+4\->I \IfEnd \If \Mat M[U,V]=42 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"-..-/" I+5\->I \IfEnd \If \Mat M[U,V]=32 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"-.--/" I+5\->I \IfEnd \If \Mat M[U,V]=71 \Then \If I+5>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"--../" I+5\->I \IfEnd \If J=7\ And I>15 \Then \Locate 21,7,"\->" \Do:\Getkey \LpWhile \Ans=0 \ClrText 1\->I~J \IfEnd \Next \Next \If I+2>21 \Then J+1\->J 1\->I \IfEnd \Locate I,J,"//" \Locate 21,7,"\->" \Do:\Getkey \LpWhile \Ans=0 0\->A~Z 3\->A \ClrMat M \GotoZ\@00 %End