> <>,无限顺序,178个字节
该程序包含尾随换行符。
^
.
*
&
:
&
+
*
2
b
*
*
6
9
$
0
)
*
4
8
:
~
.
*
&
:
&
+
*
2
b
*
*
2
b
$
0
)
i
:
-
1
o
a
&
:
&
o
~
.
*
&
:
&
+
*
7
7
*
*
4
6
$
0
)
0
:
-
1
$
o
:
$
&
:
&
&
,
*
8
b
-
1
l
}
*
3
d
'
在线试用: 1,2,3,10(这最后一个需要一段时间来运行。)
视网膜脚本从线性程序生成源。
说明
主要思想是将木盒垂直放置,以使实际的控制流程不受重复的影响。例如,第二个超级quine开始如下:
^^
..
**
由于我们只浏览第一列,因此不必担心重复的字符。同样,当我们使用来将大多数代码作为字符串'
推送时,这将为每个空行推送一个空格,这为我们提供了一种确定重复次数的方法。就是说,由于这些空行,存在一些限制:
- 我们不能用
"
大数字作为quine主体部分中的字符代码,因为这会增加32
我们不想要的其他s。
- 我们不能使用
?
或!
因为它们仅跳过下一个字符(在这种情况下为空格)(因此他们实际上不会跳过下一个命令)。
因此,所有控制流程都是通过显式跳转(基本上是2D goto)完成的,我们需要根据重复次数来计算其实际偏移量。
因此,让我们看一下实际的代码。我们从头开始,^
因此代码是自下而上执行的。为了便于阅读,让我们按执行顺序写出实际代码(并删除,^
因为它不再被执行):
'd3*}l1-b8*,&&:&$:o$1-:0)0$64**77*+&:&*.~o&:&ao1-:i)0$b2**b2*+&:&*.~:84*)0$96**b2*+&:&*.
这'
是> <>(和Befunge,我想)的标准quinquin技术。它切换到字符串模式,这意味着将遇到的字符压入堆栈,直到'
遇到下一个为止。空行用空格隐式填充,这就是为什么我们要得到它们之间的所有空格。程序末尾的空行将被忽略。因此,在IP回绕并'
再次命中之后,我们将程序的第一列放在堆栈上,除了'
本身。
让我们看看如何使用它来打印整个程序。
d3*} Put a 36 (the ') at the bottom of the stack. Now the stack holds
a representation of the entire first column.
l1- Push the depth of the stack, minus (so minus to ').
b8*, Divide by 88. The original program has 89 lines. If we divide the
depth of the stack (minus 1) by 88, we get the order of the current
hyperquine (due to all the spaces we've pushed).
& Store the order of the hyperquine in the register.
Begin of main loop:
&:& Push a copy of the register onto the stack. Call that N.
Begin of line-printing loop:
$:o$ Print a copy of the top character on the stack.
1- Decrement N.
:0) Check whether it's still positive (gives 0 or 1).
0$ Put a 0 underneath. This will be the x-coordinate of a jump.
64** Multiply the conditional by 24. This is the number of commands
in this inner loop.
77*+ Add this to 49, the offset of the end of the loop.
The result is line we want to jump to in the order-1 hyperquine.
&:&* Multiply by the order of the quine (so that we jump further on
higher quine orders).
. Jump. If N isn't zero yet, this repeats the inner loop. Otherwise
we continue right here.
~ Discard N (now 0).
o Output one last copy of the top character on the stack.
&:& Push a copy of the register onto the stack. Call that N.
Begin of linefeed-printing loop:
ao Print a linefeed.
1- Decrement N.
:i) Check whether it's still non-negative (gives 0 or 1).
The next bit is essentially the same loop structure as above,
but with loop length 22 and offset 22:
0$
b2**
b2*+
&:&*
. Jump. If N isn't -1 yet, this repeats the inner loop. Otherwise
we continue right here.
Begin of space-clearing loop:
~ Discard the top of the stack. On the first iteration this is the
-1 from the previous loop. Afterwards, it's one of the spaces
representing an empty line.
:84*) Check if the top of the stack is a space.
And another loop conditional. This one works the other way round:
the difference is 54, which is the distance between the beginning
of this loop and the main loop. The offset is the beginning
of this loop, at 22 as above.
0$
96**
b2*+
&:&*
. Jump. If the top of the stack is still a space this repeats the
inner loop. Otherwise we continue from the top of the main loop.
当堆栈为空且第一个内部循环无法打印另一个字符时,程序终止。