Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
25
Task/Caesar-cipher/OmniMark/caesar-cipher.xom
Normal file
25
Task/Caesar-cipher/OmniMark/caesar-cipher.xom
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
; caesar.xom
|
||||
global integer gi-k initial {13}
|
||||
global stream gs-ed initial {'encode'}
|
||||
global stream gs-phrase
|
||||
|
||||
define stream function apply-cipher (value stream phrase, value integer k, value stream ed) as
|
||||
local integer b
|
||||
local stream ciphered
|
||||
open ciphered as buffer
|
||||
repeat scan phrase
|
||||
match letter => char
|
||||
set b to char binary 0
|
||||
increment b by k when ed = 'encode'
|
||||
increment b by 26 - k when ed = 'decode'
|
||||
decrement b by 26 when char matches uc and b > 90
|
||||
decrement b by 26 when char matches lc and b > 122
|
||||
put ciphered "b" % b
|
||||
match any => char
|
||||
put ciphered char
|
||||
again
|
||||
close ciphered
|
||||
return ciphered
|
||||
|
||||
process
|
||||
output apply-cipher(gs-phrase, gi-k, gs-ed) || '%n%n'
|
||||
Loading…
Add table
Add a link
Reference in a new issue