This is alternate of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those!
Your task, if you accept it, is to write a program/function that outputs/returns its input/args. But again, The tricky part is that if I rot-13
your source code, the output must be returned rot-19
.
Your code will be only rotated once.
Examples
Let's say your source code is ABC
and the input is xyz
.
Code ABC
should return xyz
.
Code NOP
(rotated) should return -./
(Rot-19).
Details
- If your language has a custom codepage, apply rot13 to the bytes in the printable ASCII range in your code, and do not modify the rest. The input and output will be in pure printable ASCII.
- The input only contains ASCII character.
- use printable ASCII table for rotating
- rot-13 means to forward 13 positions in ASCII table
- Same applied to rot-19, which forward 19 positions instead.
Rules
- Input can be taken in any convenient format.
- Output can be in any convenient format as well.
- Standard Loopholes are forbidden.
scoring
This is code-golf so the answer with the fewest amount of bytes wins.
Extra scoring rule
If there's somehow, a non-esolang appeared as a valid answer, it may considered as a better answer.
Example: python
, C++
, java script
etc.
If you are confused with Rot
Here is a encoder to get some idea with.
(削除) Use full ACSII Table for this question’s requirement. (削除ここまで)
Use printable ASCII Table (33 ~126) for rotation!
Space
are 32 in ASCII, which count as unprintable!
6 Answers 6
JavaScript (Node.js), 50 bytes
a=>01+"25ドルhYYXeya=>z!`TcyV01yV~$'zv,'|&&z|xx-$"&&a
Both versions are a function which takes a string as input and returns a string.
ROT13 code:
nJK=>8/1?Buffer(nJK).map(c=>(c-14)%94+33)+'':1/33n
Explanation
Hides tricky characters used in the ROT19 logic inside a string. The quotes map to /
characters so it's just a matter of finding where to put them to make it work.
-
\$\begingroup\$ woah... I didn’t thought there would be a non-golf lang answer. congratulation! \$\endgroup\$okie– okie2021年03月24日 23:14:18 +00:00Commented Mar 24, 2021 at 23:14
-
\$\begingroup\$ Is this allowed to use comment? \$\endgroup\$tsh– tsh2021年03月25日 09:57:25 +00:00Commented Mar 25, 2021 at 9:57
-
\$\begingroup\$ @tsh sorry for the late reply, but yes, you are allowed to use comment \$\endgroup\$okie– okie2021年04月07日 01:25:47 +00:00Commented Apr 7, 2021 at 1:25
05AB1E, (削除) 11 (削除ここまで) 9 bytes
-2 thanks to ovs.
žD¦7,ドル!R‡
žD¦7,ドル!R‡ # full program
, # output...
$ # input
=BNO>R, (削除) 11 (削除ここまで) 9 bytes
žQ¦D19._‡
žQ¦D19._‡ # full program
‡ # push...
# implicit input...
‡ # with each...
žQ # ASCII character...
¦ # excluding the first...
‡ # replaced by corresponding character in...
žQ D # ASCII characters...
¦ # excluding the first...
._ # rotated...
19 # literal...
._ # characters to the left
# implicit output
Python 3.8 (pre-release), 75 bytes
Comment still do the trick quiet well :).
t=print(input())
#.ce\agyxx!]b\ayNV[eyybeWy\z~$'zv,'|&&zYbe \ \a \achgyzPzz
#J}!v{#5v{}$#566
0;print(''.join([chr((ord(i)-14)%94+33)for i in input()]))
-
\$\begingroup\$ Doesn't this append the input reversed when rot-13'ed, rather than rot-119'ing the input? \$\endgroup\$2021年04月14日 11:21:31 +00:00Commented Apr 14, 2021 at 11:21
-
\$\begingroup\$ Ouch, sry, i will update the code, I mess up this one with palindrome one \$\endgroup\$okie– okie2021年04月14日 11:22:09 +00:00Commented Apr 14, 2021 at 11:22
Charcoal, 96 bytes
⭆S§Φγμ+Σ+&+⌕Φγμι
Try it online! After ROT13, this becomes:
⭆S§Φγμ+Σ838⌕Φγμι
Try it online! Explanation:
S Input string
⭆ Map over characters and join
838 Literal string `+&+` or `838`
Σ Digital sum i.e. 0 or 19
+ Plus
⌕ Index of
ι Current character in
γ ASCII characters
Φ Filtered where
μ Current index is non-zero
§ Index into
γ ASCII characters
Φ Filtered where
μ Current index is non-zero
Implicitly print
Pxem, Filename: 60 bytes + Content: 0 bytes = 60 bytes.
- Filename (escaped):
.w.o.i.c001円.+.a.d!md!T!j!b!\\!V !k!V177円!lG!|Q!vr!|KK!TKK!T!V001円!|!T
- Actual:
.w.o.i.c.+.a.d!md!T!j!b!\!V !k!V!lG!|Q!vr!|KK!TKK!T!V!|!T
- Actual:
- Content: empty.
With comments
See also: Simple cat program
XX.z
# pasted cat program
.a.w.o.i.c001円.+.aXX.z
# exit
.a.dXX.z
# these literals are ignored
.a!md!T!j!b!\\!V !k!V177円!lG!|Q!vr!|KK!TKK!T!V001円!|!T
]'rz.
- Filename (escaped):
;&;|;v;p001円;8;n;q.zq.a.w.o.i.c .x.c177円.yT.+^.%!.+XX.aXX.a.c001円.+.a
- Actual:
;&;|;v;p;8;n;q.zq.a.w.o.i.c .x.c.yT.+^.%!.+XX.aXX.a.c.+.a
- Actual:
- Content: empty.
With comments
XX.z
# they are just literals but discarded later
.aXX;&;|;v;p001円;8;n;q.z
# while size<2||pop!=0; do push 'q'; done
.a.zq.aXX.z
# while empty||pop!=0; do
.a.wXX.z
# if ! empty; then putchar pop; fi
.a.oXX.z
# push getchar; dup; push 32;
# while size<2||pop<pop; do
.a.i.c .xXX.z
# dup; push 127; while size<2||pop>pop; do
.a.c177円.yXX.z
# push 84; push pop+pop;
# push 94;
# push ((x=pop)<(y=pop))?y%x:x%y
.aT.+^.%XX.z
# push 33; push pop+pop;
.a!.+XX.z
# push X; push X; done (* idiom for BREAK statement *)
.aXX.aXX.z
# push X; push X; done
.aXX.aXX.z
# dup; push 1; push pop+pop; done
.a.c001円.+.a
Explore related questions
See similar questions with these tags.
rot19(xyz)
=♀♪♫
? I thought it should only rotate to ASCII. Also you mention "128 char" ASCII. Does that mean we should rotate characters at the end of the ASCII range into non-printable control characters? \$\endgroup\$