The g
et command, shared by Befunge and ><>, is a command that pops two values x and y and retrieves a value stored at that cell (its counterpart is the p
ut command, which stores a value at a certain cell). The problem is that the 2D surface is the same surface the source code is running off, with uninitialised cells being value 0.
Here is an example of 3 ><> quines, with varying use of the g
command:
0:0g:?!;o1+!
This simply iterates over the first line using the get command until it reaches an uninitialised cell (disregard that it's invalid for other reasons).
"r00g>o<
This g
ets the "
from the first cell, avoiding having to calculate the value manually, which is two bytes longer(75*1-
).
'rd3*>o<
This avoids the use of the g
command altogether and should be valid regardless.
Okay, let me add an edge case to illustrate.
Say there's a challenge to find the product of two positive numbers below 5 without actually using multiplication. Underneath our actual code, we create a box with the appropriate values so that we could simply grab the value at that point on the grid. In Befunge, for example:
& & g . @
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
(Pretend that the numbers are the cell values). Does this count as reading the source code, even when the closest analogy would be declaring a 2D array?
How about the wrapping string literal, a common staple of the 2D language quine? It is also accessing the exact same data that the get command is fetching its data from, which seems like a bit of a double standard to me.
And just the normal string literal? Take the Befunge program "@"#,<
, which reuses the @
as both the printed character, and the terminating instruction. Does this count as reading the source code, as it both executes and reads the same character?
!
is input (therefore invalid) or data (valid, but not technically BF) \$\endgroup\$weave.rb
BF+ interpreter supports!
as a flag. \$\endgroup\$!
don't count as input, then the,
command no longer reads input, but instead reads from an array. I'm pretty sure this is against BF spec. \$\endgroup\$