堆猫 -m
,4个字节
|>I|
在线尝试!
尝试反向!
此方法适用于任何不包含空字节的输入。
说明
哇,我已经到了用手写的方式了...
完整的程序是|>I|I<|
。
| Reverse the entire stack down to the EOF marker -1 (since there are no zeros in the input).
> Move one stack over to the right (which only contains zeros).
I Does nothing on zero.
| Does nothing on zero.
I Does nothing on zero.
< Move back to the initial stack.
| Reverse the input once more.
与之前挑战的解决方案一样,由于居中命令 |
不执行任何操作,因此整个程序也不执行。
则反向程序为|I>|<I|
。
| Reverse the entire stack down to the EOF marker -1 (since there are no zeros in the input).
I Move the -1 one stack to the left and turn it into a +1.
> Move back to the initial stack.
| Reverse it again, but this time without the EOF marker.
< Move back to the left.
I Move the +1 back onto the initial stack and turn it into a -1 again.
| Reverse the entire stack. We now have the -1 as an EOF marker again at the bottom
and the rest of the stack has been reversed three times, i.e. one net reversal.
有趣的是,如果这次没有使用这个可逆程序,-m
我们仍然没有一个可行的解决方案,那么省略的唯一额外字节-m
就是我们通过镜像代码获得的字节。
|I<|>I|
在线尝试!
尝试反向!
说明
该程序的反向版本是|I>|<I|
,与上述相同,因此我们可以忽略它。但是非反转版本有所不同。从<>
现在开始,中心命令最终什么也不做,因此程序变成了猫:
| Reverse the entire stack down to the EOF marker -1 (since there are no zeros in the input).
I Move the -1 one stack to the left and turn it into a +1.
< Move another stack to the left, which contains only zeros.
| Does nothing on zero.
因此,请>I|
完全撤消程序的前半部分。