Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/Straddling-checkerboard/11l/straddling-checkerboard.11l
Normal file
28
Task/Straddling-checkerboard/11l/straddling-checkerboard.11l
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
V t = [[String(‘79’), ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’],
|
||||
[String(‘’), ‘H’, ‘O’, ‘L’, ‘’, ‘M’, ‘E’, ‘S’, ‘’, ‘R’, ‘T’],
|
||||
[String(‘3’), ‘A’, ‘B’, ‘C’, ‘D’, ‘F’, ‘G’, ‘I’, ‘J’, ‘K’, ‘N’],
|
||||
[String(‘7’), ‘P’, ‘Q’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’, ‘.’, ‘/’]]
|
||||
|
||||
F straddle(s)
|
||||
R multiloop_filtered(Array(s.uppercase()), :t, (c, l) -> c C l, (c, l) -> l[0]‘’:t[0][l.index(c)]).join(‘’)
|
||||
|
||||
F unstraddle(s)
|
||||
[String] r
|
||||
V si = 0
|
||||
F next()
|
||||
R @s[@si++]
|
||||
L
|
||||
I si == s.len
|
||||
L.break
|
||||
V c = s[si++]
|
||||
I c C (:t[2][0], :t[3][0])
|
||||
V i = [:t[2][0], :t[3][0]].index(c)
|
||||
V n = :t[2 + i][:t[0].index(next())]
|
||||
r [+]= I n == ‘/’ {next()} E n
|
||||
E
|
||||
r [+]= :t[1][:t[0].index(c)]
|
||||
R r
|
||||
|
||||
V O = ‘One night-it was on the twentieth of March, 1888-I was returning’
|
||||
print(‘Encoded: ’straddle(O))
|
||||
print(‘Decoded: ’unstraddle(straddle(O)).join(‘’))
|
||||
Loading…
Add table
Add a link
Reference in a new issue