REM ACSL
Intermediate 4
REM Conrad Weiser
REM Christian
Chimenko
REM TrueBASIC
DIM
step2(1,1),encode(2,2),step1(1,1)
FOR a=1 to 5
LET message$=""
PRINT "Input #";str$(a);
INPUT prompt ": ":howmany
MAT redim step2(ceil(howmany/2),2),step1(ceil(howmany/2),2)
FOR i=1 to howmany
INPUT prompt "":idata
IF i<=ceil(howmany/2) then
LET step2(i,1)=idata
ELSE
LET step2(i-howmany/2,2)=idata
END IF
NEXT i
FOR j=1 to 2
FOR i=1 to 2
INPUT prompt
"":encode(i,j)
NEXT i
NEXT j
MAT encode=inv(encode)
MAT step1=step2*encode
FOR i=1 to ceil(howmany/2)
FOR j= 1 to 2
IF ((step1(i,j)=27) or (str$(step1(i,j))="27."))
or ((ip(step1(i,j))=0) or (str$(step1(i,j))="0.")) then
LET message$=message$&"
"
ELSE
IF step1(i,j)>27 then
LET
message$=message$&chr$(64+(mod(step1(i,j),27)))
ELSE IF step1(i,j)<0 then
LET
message$=message$&chr$(91+step1(i,j))
ELSE
LET
message$=message$&chr$(64+step1(i,j))
END IF
END IF
NEXT j
NEXT i
PRINT
"Output #";str$(a);": ";message$
PRINT
PRINT
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
PRINT
NEXT a
END