4
\$\begingroup\$

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!
Wheat Wizard
103k23 gold badges299 silver badges696 bronze badges
asked Mar 24, 2021 at 9:08
\$\endgroup\$
17
  • 2
    \$\begingroup\$ "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." So a language that uses a code page which doesn't include any ASCII is excluded from this challenge, right? \$\endgroup\$ Commented Mar 24, 2021 at 9:27
  • 1
    \$\begingroup\$ Is the rot13 on the ASCII subset of a custom codepage relative to the codepage or to ASCII? \$\endgroup\$ Commented Mar 24, 2021 at 9:28
  • 1
    \$\begingroup\$ So, how rot 13 and rot 19 works? \$\endgroup\$ Commented Mar 24, 2021 at 9:48
  • 4
    \$\begingroup\$ This is why it is recommended to use the sandbox for challenges before posting to main. \$\endgroup\$ Commented Mar 24, 2021 at 10:12
  • 2
    \$\begingroup\$ Why does 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\$ Commented Mar 24, 2021 at 12:38

6 Answers 6

10
\$\begingroup\$

JavaScript (Node.js), 50 bytes

a=>01+"25ドルhYYXeya=>z!`TcyV01yV~$'zv,'|&&z|xx-$"&&a

Try it online!

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.

answered Mar 24, 2021 at 13:50
\$\endgroup\$
3
  • \$\begingroup\$ woah... I didn’t thought there would be a non-golf lang answer. congratulation! \$\endgroup\$ Commented Mar 24, 2021 at 23:14
  • \$\begingroup\$ Is this allowed to use comment? \$\endgroup\$ Commented Mar 25, 2021 at 9:57
  • \$\begingroup\$ @tsh sorry for the late reply, but yes, you are allowed to use comment \$\endgroup\$ Commented Apr 7, 2021 at 1:25
4
\$\begingroup\$
answered Mar 24, 2021 at 18:01
\$\endgroup\$
4
\$\begingroup\$

05AB1E, (削除) 11 (削除ここまで) 9 bytes

-2 thanks to ovs.

žD¦7,ドル!R‡

Try it online!

žD¦7,ドル!R‡ # full program
 , # output...
 $ # input

=BNO>R, (削除) 11 (削除ここまで) 9 bytes

žQ¦D19._‡

a!( v# |{yv{r.

ž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
answered Mar 24, 2021 at 17:25
\$\endgroup\$
1
  • \$\begingroup\$ 9 bytes using transliterate. \$\endgroup\$ Commented Apr 14, 2021 at 12:39
3
\$\begingroup\$

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

Try it online!

#J}!v{#5v{}$#566
0;print(''.join([chr((ord(i)-14)%94+33)for i in input()]))

a!( v# |{yv{r.

answered Apr 14, 2021 at 11:16
\$\endgroup\$
2
  • \$\begingroup\$ Doesn't this append the input reversed when rot-13'ed, rather than rot-119'ing the input? \$\endgroup\$ Commented Apr 14, 2021 at 11:21
  • \$\begingroup\$ Ouch, sry, i will update the code, I mess up this one with palindrome one \$\endgroup\$ Commented Apr 14, 2021 at 11:22
1
\$\begingroup\$

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
answered Mar 25, 2021 at 1:34
\$\endgroup\$
1
\$\begingroup\$

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
  • 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

Try it online!

]'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
  • 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

a!( v# |{yv{r.

answered Mar 30, 2021 at 12:18
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.