catseye / FBBI

MIRROR of https://codeberg.org/catseye/FBBI : The Flaming Bovine Befunge-98 Interpreter.
https://catseye.tc/node/FBBI
Other
4 stars 1 forks source link

Is k implemented correctly? #1

Open m-ender opened 7 years ago

m-ender commented 7 years ago

The iterate command k seems to treat 0 specially. In particular, I'm observing the following behaviour:

I'm not sure whether this is the way it was intended, but the specification (looking at this document: https://github.com/catseye/Funge-98/blob/master/doc/funge98.markdown) doesn't mention that 0 is treated differently from other inputs. It mentions that zero would skip the next instruction entirely, but I had assumed that this means argument 1 would result in it being executed exactly once.

j4james commented 7 years ago

I'll leave it to Chris to tell you what the spec was intended to mean, but it's worth mentioning that most Funge-98 interpreters work the same way. I've tested this on PyFunge, CCBI, Fungi, cfunge, rcfunge, and Befungius, and they all treat 0k as skipping the next instruction, and 1k as repeating the instruction twice.

That said, there was a Funge-108/109 spec floating around for a while in which the k behaviour was changed to work the way you expected it would (i.e. 1k only executes the following instruction once). However cfunge is the only interpreter I'm aware of that supports that option (rcfunge has some 108 features, but not that).