Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
69
Task/Chaocipher/EasyLang/chaocipher.easy
Normal file
69
Task/Chaocipher/EasyLang/chaocipher.easy
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
proc index c$ . a$[] ind .
|
||||
for ind = 1 to len a$[]
|
||||
if a$[ind] = c$
|
||||
return
|
||||
.
|
||||
.
|
||||
ind = 0
|
||||
.
|
||||
left$ = "HXUCZVAMDSLKPEFJRIGTWOBNYQ"
|
||||
right$ = "PTLNBQDEOYSFAVZKGJRIHWXUMC"
|
||||
#
|
||||
func$ chao txt$ mode .
|
||||
left$[] = strchars left$
|
||||
right$[] = strchars right$
|
||||
len tmp$[] 26
|
||||
for c$ in strchars txt$
|
||||
# print strjoin left$[] & " " & strjoin right$[]
|
||||
if mode = 1
|
||||
index c$ right$[] ind
|
||||
if ind = 0
|
||||
return ""
|
||||
.
|
||||
r$ &= left$[ind]
|
||||
else
|
||||
index c$ left$[] ind
|
||||
if ind = 0
|
||||
print c$
|
||||
return ""
|
||||
.
|
||||
r$ &= right$[ind]
|
||||
.
|
||||
# permute left
|
||||
for j = ind to 26
|
||||
tmp$[j - ind + 1] = left$[j]
|
||||
.
|
||||
for j = 1 to ind - 1
|
||||
tmp$[26 - ind + j + 1] = left$[j]
|
||||
.
|
||||
h$ = tmp$[2]
|
||||
for j = 3 to 14
|
||||
tmp$[j - 1] = tmp$[j]
|
||||
.
|
||||
tmp$[14] = h$
|
||||
swap tmp$[] left$[]
|
||||
#
|
||||
# permute right
|
||||
for j = ind to 26
|
||||
tmp$[j - ind + 1] = right$[j]
|
||||
.
|
||||
for j = 1 to ind - 1
|
||||
tmp$[26 - ind + j + 1] = right$[j]
|
||||
.
|
||||
h$ = tmp$[1]
|
||||
for j = 2 to 26
|
||||
tmp$[j - 1] = tmp$[j]
|
||||
.
|
||||
tmp$[26] = h$
|
||||
h$ = tmp$[3]
|
||||
for j = 4 to 14
|
||||
tmp$[j - 1] = tmp$[j]
|
||||
.
|
||||
tmp$[14] = h$
|
||||
swap tmp$[] right$[]
|
||||
.
|
||||
return r$
|
||||
.
|
||||
h$ = chao "WELLDONEISBETTERTHANWELLSAID" 1
|
||||
print h$
|
||||
print chao h$ 2
|
||||
Loading…
Add table
Add a link
Reference in a new issue