Straddling checkerboard: Difference between revisions
Content added Content deleted
(Updated D entry) |
(→{{header|Tcl}}: added zkl) |
||
Line 1,585: | Line 1,585: | ||
Input: One night-it was on the twentieth of March, 1888-I was returning |
Input: One night-it was on the twentieth of March, 1888-I was returning |
||
Encoded: 450582425181653945125016505180125423293721256216286286288653970163758524 |
Encoded: 450582425181653945125016505180125423293721256216286286288653970163758524 |
||
Decoded: ONENIGHTITWASONTHETWENTIETHOFMARCH1888IWASRETURNING |
|||
</pre> |
|||
=={{header|zkl}}== |
|||
{{trans|D}} |
|||
<lang zkl>var [const] |
|||
val2key=D( |
|||
"A","30", "B","31", "C","32", "D","33", "E","5", "F","34", "G","35", |
|||
"H","0", "I","36", "J","37", "K","38", "L","2", "M","4", ".","78", "N","39", |
|||
"/","79", "O","1", "0","790", "P","70", "1","791", "Q","71", "2","792", |
|||
"R","8", "3","793", "S","6", "4","794", "T","9", "5","795", "U","72", |
|||
"6","796", "V","73", "7","797", "W","74", "8","798", "X","75", "9","799", |
|||
"Y","76", "Z","77"), |
|||
key2val=val2key.pump(D(),"reverse"); |
|||
fcn encode(txt){ txt.toUpper().pump(String,val2key.find.fp1("")) } |
|||
fcn decode(str){ RegExp("79.|3.|7.|.").munch(str).pump(String,key2val.get) }</lang> |
|||
<lang zkl>txt:="One night-it was on the twentieth of March, 1888-I was returning"; |
|||
str:=encode(txt); |
|||
println("Encoded: ", str); |
|||
println("Decoded: ", decode(str));</lang> |
|||
{{out}} |
|||
<pre> |
|||
ncoded: 139539363509369743061399059745399365901344308320791798798798367430685972839363935 |
|||
Decoded: ONENIGHTITWASONTHETWENTIETHOFMARCH1888IWASRETURNING |
Decoded: ONENIGHTITWASONTHETWENTIETHOFMARCH1888IWASRETURNING |
||
</pre> |
</pre> |