-3
1
Challenge
Return the full contents of your program, but inverted. How do your invert something? Well,
Letters: Take the position of the letter in the alphabet, subtract from 26, and use the letter at that position and flip the case of the letter. E.g A
becomes z
, and p
becomes J
.
Digits: Subtract from 9. E.g 6
becomes 3
and 5
becomes 4
Brackets: The brackets (){}[]<>
become their corresponding closing/opening bracket. E.g [
becomes ]
and >
becomes <
Other
&
and|
swap.- ' ' [space] and '\n' [newline] swap.
£
and$
swap, as do€
and¥
¢
and%
swap_
and-
swap"
and'
swap?
and!
swap:
and;
swap/
and\
swap@
and#
swap~
and`
swap,
and.
swap©
and®
swap
All other characters become their Unicode inverse (subtract from 137,374). However, if the result is specified above, you must replace it again with the replacement provided. You only need to run a maximum of two replacements on each character, so no infinite loops.
Rules
- Standard loopholes are disallowed
"the final product cannot be inverted any more" - but if you have one of the defined replacements (e.g. a letter) you can always invert it? So what do you really mean – ASCII-only – 2019-02-22T10:41:34.197
Also, I'd highly recommend against that arbitrary "at least 4 characters in length" restriction – ASCII-only – 2019-02-22T10:46:07.747
Sorry, that was an oversight on my part. Fixed. – Geza Kerecsenyi – 2019-02-22T10:46:22.120
The restriction on characters is just to avoid esoteric answers. – Geza Kerecsenyi – 2019-02-22T10:47:15.057
3Sure... but I highly doubt there is (or ever will be) a language that can do this in 4 bytes, and even if so, the solution wouldn't be very interesting so it's not really a problem. 4 characters... maybe, if you count combining marks on the same character as a single character, but that doesn't matter since we count in bytes here – ASCII-only – 2019-02-22T10:49:04.060
Removed char restrictions – Geza Kerecsenyi – 2019-02-22T11:30:22.837
2Would have been much better if it were a little simpler, with fewer rules of inversion. But that's just my opinion (which I am not supposed to have). – Arjun – 2019-02-22T11:46:11.663
1Why did you accept my answer?.. :S It's way too soon, and it's not even the shortest.. – Kevin Cruijssen – 2019-02-22T15:00:44.360
150 bytes but can't answer because on hold – Nahuel Fouilleul – 2019-02-24T21:19:49.157
R, 190 bytes; can't answer because on hold, but would like to see this challenge reopened. – Nick Kennedy – 2019-02-24T23:51:53.923
bash +tr, 104 bytes – Nahuel Fouilleul – 2019-02-25T08:36:27.720
1
Hi there! I see that this and your previous challenge have lots of comments beneath them asking for clarification or other improvements. Since you're rather new here, I would like to point out that we have a place for challenges to get refined before they get posted here. We call it The Sandbox. I've liked both of your challenges so far, so I hope you continue to stay on PPCG and enjoy all the time you spend here. :-)
– Giuseppe – 2019-02-25T20:48:38.710Thanks for the help @Giuseppe. I've heard of/seen the sandbox before, but wasn't sure how to use it. Thanks though - I understand now. – Geza Kerecsenyi – 2019-02-26T21:39:30.070
Hi, I've edited your question to be a bit clearer. If there is anything I've done that you feel is not what you want, please correct me. In particular, I've removed the restrictions
Any reasonable language is fine
,unless the \ is part of a control character
, the whole thing with the monkey emoji and the [tag:kolmogorov-complexity] tag. Hopefully this can be reopened and the solutions in the comments can be posted :) – Jo King – 2019-03-03T05:55:22.770