-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can x
set delta with Manhattan length longer than 1? And what are the "the least/greater point which contains a non-space cell, relative to the origin"?
#8
Comments
The spec does not specify any restriction on the delta that can be set with
The spec defines "least point" as "point with the smallest numerical coordinates of a region; also known as the upper-left corner, when used in the context of Befunge". (this is defined in the "File Input/Output" section, for whatever reason.) I interpret this to mean: if you have a set of points in Funge-space, and you enclose them in the smallest possible rectangle that encloses them, the least point is the upper-left corner of that rectangle - it has the smallest co-ordinate values. (and the greatest point is, correspondingly, the lower-right corner.) I interpret "relative to the origin" to mean, the value reported by
I would interpret it to be (-1, -1), even though this cell actually contains space. i.e. My interpretation is that "contains a non-space cell" refers to the region rather than the least point itself. I think a complaint that the spec uses language strangely for this definition, would be a valid complaint.
Then it would be (0, 0), assuming that's where your program starts. But that's just my interpretation -- you might want to test it on some other Befunge interpreters to see what they say. But also note, what I've said above applies to the value reported by
I don't know what you mean by "shift", but this sentence from the spec:
...certainly rules out many of the possibilities that come to my mind from the word "shift". If the program occupies (0, 0)-(20, 0) and the IP is at (20, 0) and its delta is (1, 0) and you have written a non-space value into (-1, -1), the IP will wrap around to (0, 0). The fact there is a value at (-1, -1) does not affect it. The concept extends to delta values with Manhattan distance >1, because even though these deltas might skip over cells as the IP moves, these deltas still define lines. If, in the above example, the IP was at (0, 0) and its delta was (5, -3), it would execute the instruction at (0, 0) over and over again, because there are no other instructions on that line. It stays on the same line. This is why it's called "same-line wrapping". Hope this explanation makes sense and is helpful. |
And if the delta was (1, 1) it would wrap to (19, -1), right? If so I guess I now understand the "same-line wrapping", but: What if the non-space characters are scattered from (0,0) to (10,0), the IP is at (9,0) and the delta is (3,0)? Will it jump to (0,0) or (2,0)?
I would like to refer to your interpretation if someone asks me "why (my) interpreter works like this...?" when I finish it. |
Answering my own question:
I guess not, it will just loop forever because there is nothing to the North-West from it. More questions:
How does it work if cell is bigger than one byte?
What are other markers? |
It’s undefined behaviour, you can do whatever you want. That being said, most interpreters that I’ve tried interpret this as (essentially) using the next instruction that would have been executed if the so This is also tested in Mycology. If you’re looking for more |
I'm implementing Befunge-98 in Ruby.
The problem is that according to the Lahey-space wrapping the backtracking a long delta is not the same as circling around a sphere -- it is going to have a shift.
Also because of that it is not clear where it should stop on the other side in case, for example, when dx=0, dy>1 and the column starts lower than some another column. I.e. what is the "addressable space" -- if the program is
0001-p 001-0p
, where is now the "least point which contains a non-space cell"? And what if Ip
ut 32 instead of 0?The text was updated successfully, but these errors were encountered: