Befunge- 98,884,n = 14,得分≈2.636
f00f00f00f00f00f00f00f00f00f00f00f00f00f00f0xxxxxxxxxxxxxxx"""""""""""""""fffffffffffffff'''''''''''''''000000000000000\\\\\\\\\\\\\\\'''''''''''''''000000000000000\\\\\\\\\\\\\\\'''''''''''''''fffffffffffffff\\\\\\\\\\\\\\\111111111111111---------------:::::::::::::::!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!000000000000000aaaaaaaaaaaaaaa---------------bbbbbbbbbbbbbbb---------------***************jjjjjjjjjjjjjjj$$$$$$$$$$$$$$$'''''''''''''''+++++++++++++++kkkkkkkkkkkkkkk,,,,,,,,,,,,,,,333333333333333kkkkkkkkkkkkkkk$$$$$$$$$$$$$$$000000000000000{{{{{{{{{{{{{{{'''''''''''''''888888888888888uuuuuuuuuuuuuuu'''''''''''''''!!!!!!!!!!!!!!!111111111111111+++++++++++++++'''''''''''''''xxxxxxxxxxxxxxx###############;;;;;;;;;;;;;;;:::::::::::::::!!!!!!!!!!!!!!!kkkkkkkkkkkkkkk@@@@@@@@@@@@@@@dddddddddddddddkkkkkkkkkkkkkkk:::::::::::::::eeeeeeeeeeeeeeekkkkkkkkkkkkkkk,,,,,,,,,,,,,,,;;;;;;;;;;;;;;;
在线尝试!
这不仅在删除精确的14个字符时起作用,甚至在删除不超过 14个字符的任何数量时也是如此。
n = 14
看起来似乎是一个非常随意的选择,但是我使用的技术实际上只能用于1到14的辐射强化命令,但不容易超出此范围(可能,但是我不知道如何做)。order-1 quine仅为73个字节(尽管它采用了一些不适用于Large的高尔夫技巧n
):
200 20 xx""''ÈÈ..aa22**..33kk$$00{{''!!uu''!!11++''xx##;;::!!kk@@::,,,,;;
说明
在研究此答案时,我发现可以(2,0)
使用以下代码段在辐射硬化条件下将指令指针的增量设置为:
20020xx
请参阅该答案以了解其工作原理。我发现这只是用手一点儿摆弄,但这提出了一个问题,即是否存在去除多个字符后仍很健壮的相似模式。因此,我编写了一个简短的Mathematica脚本,以蛮力搜索这些脚本:
n = 14;
m = 4;
Print @ FromDigits @ {
m + 1, 0,
## & @@ ((m + 1) IntegerDigits[#, 2, n - 4]),
m + 1, 0
} & /@ Select[
Range[0, 2^(n - 4) - 1],
AllTrue[
Subsets[{
m + 1, 0,
## & @@ ((m + 1) IntegerDigits[#, 2, n - 4]),
m + 1, 0
},
{n - m, n - 1}
] //. {a___, _, m + 1} | {a___, 0, _} :> {a},
MatchQ@{___, m + 1, 0}
] &
];
这很快显示出一种模式。要获取可删除最多n
字符的相应代码段,您可以使用(m0x){n}m0
where m
is n+1
and x
is m
或0
。因此,以下所有内容都可以删除最多两个字符:
30030030
30030330
30330030
30330330
我敢肯定有可能证明这一点,但我只验证n
了7
。当然,只有在我们可以表示n+1
为一个数字的情况下,此方法才有效,并且Befunge 98中最大的数字是f
15。这就是为什么我的方法仅限于n = 14
。如果有人找到可靠地将delta设置为更大的方法n+1
,则可能会无限期增加此经过辐射硬化的奎因的阶数。
让我们看一下实际的代码。基本上有两个部分。首先,(15,0)
正如我刚才提到的,将增量设置为:
f00f00f00f00f00f00f00f00f00f00f00f00f00f00f0xxxxxxxxxxxxxxx
其余的代码将每个命令重复15次并打印源。如果我们删除重复,它看起来像这样:
"f'0\'0\'f\1-:!!0a-b-*j$'+k,3k$0{'8u'!1+'x#;:!k@dk:ek,;
这"
是一种标准的2D quinquin技术:它开始字符串模式,将所有字符(除了自身)压入堆栈,然后在环绕后再次结束字符串模式。这有助于我们获得下半场的所有代码点,但它将无法得到我们任何从上半年有用的,因为在整个f00f00...f0
位,它只会记录两个字符(可以是f
或0
取决于哪个字符被删除)。但是由于该部分不是由重复15次的字符组成,所以无论如何我们都需要单独打印它。
更方便的是,在未修饰的quine中,字符串的长度在"
is 之前-1 (mod 15)
。这保证了无论有多少个字符(最多14个),我们如何删除,该数字记录的人物总是有3(一个x
和两个f
和0
)。实际上,对于任何辐射阶数最高为14的情况都是如此。
现在,我们开始打印f00f00...f0
零件:
f'0\'0\'f\1-:!!0a-b-*j$'+k,
f Push 15, a loop counter.
'0\'0\'f\ Put "00f" underneath the loop counter.
1- Decrement the loop counter.
:!! Copy it, and turn it into a 1 if it's positive.
0a-b- Push -21.
* Multiply by 0 if the loop counter is zero, or by 1 otherwise.
j Jump that many steps. If the value was 0, this is a no-op and
the loop ends. Otherwise, this brings us back after the f.
$ Pop the loop counter (which is now 0).
'+k, Print the top of the stack 43 times, which gives us all of
the "f00f00...f0" and leaves one "0" on top of the stack.
下一个3k$
简单地丢弃该0
字符以及"
从程序开始时按下的三个字符。现在,堆栈中仅包含字符之后的字符"
以及原始f00f00...f0
字符下方的垃圾内容,具体取决于要删除的字符。
现在,我们只需要反转堆栈的顶部(包含其余字符),然后将每个字符打印15次。
0{ Start a new, empty stack. This pushes two zeros onto the original stack.
'8u Move the top 56 values from the original stack to the new one, which
is the 54 characters after the " as well as those two zeros. This is
implemented as pop-push loop, so it reverses the order of those elements.
'!1+ Push a " by incrementing a !.
'x Push an x. Now we've got all the characters that are repeated 15 times.
#; Enter a loop. This is a standard technique for Befunge-98: the ; is
a bit like a comment character, that ignores everything until the next
;, but we jump over the first one with #, so that from now on only
the code inside will be executed (over and over).
:! Copy the top of the stack, and compute logical NOT (1 if 0, 0 otherwise).
k@ Terminate the program that many times (i.e. when the top of the
stack is zero).
dk: Make 14 copies of the top of the stack.
ek, Print 15 characters from the top of the stack.
;
就是这样。:)
Subleq
。我认为这对这种挑战将是理想的!