Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Caesar-cipher/Arturo/caesar-cipher.arturo
Normal file
23
Task/Caesar-cipher/Arturo/caesar-cipher.arturo
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
ia: to :integer `a`
|
||||
iA: to :integer `A`
|
||||
lowAZ: `a`..`z`
|
||||
uppAZ: `A`..`Z`
|
||||
|
||||
caesar: function [s, xx][
|
||||
k: (not? null? attr 'decode)? -> 26-xx -> xx
|
||||
result: new ""
|
||||
loop s 'i [
|
||||
(in? i lowAZ)? -> 'result ++ to :char ia + (k + (to :integer i) - ia) % 26
|
||||
[
|
||||
(in? i uppAZ)? -> 'result ++ to :char iA + (k + (to :integer i) - iA) % 26
|
||||
-> 'result ++ i
|
||||
]
|
||||
]
|
||||
return result
|
||||
]
|
||||
|
||||
msg: "The quick brown fox jumped over the lazy dogs"
|
||||
print ["Original :" msg]
|
||||
enc: caesar msg 11
|
||||
print [" Encoded :" enc]
|
||||
print [" Decoded :" caesar.decode enc 11]
|
||||
Loading…
Add table
Add a link
Reference in a new issue