This program analyzes 332682811as an unsigned integer-9 and prints it in the base-10.
Befunge 2D- ( , ), , . , .
9332682811 Befunge, . :
Instructions Meaning Top stack values
9332682811>\
> Set the instruction pointer to travel a b
to the right.
\ Swap the top 2 values on the stack. b a
skip the next instruction.
: Duplicate the top value on the stack. b a a
9 Push 9. b a a 9
- Pop two values and push their difference. b a (a-9)
_ Pop the top value and set the instruction b a
pointer traveling right if the value is 0
or left otherwise.
\ Swap the top 2 values. a b
9 Push 9. a b 9
* Pop two values and push their product. a (b*9)
+ Pop two values and push their sum. (b*9 + a)
> Set the instruction pointer traveling
right again.
, 9, b a b*9 + a.
9, :
Instructions Meaning Top stack values
9332682811>\
_ Pop the top value and set the instruction b a
pointer traveling right if the value is 0
or left otherwise.
$ Discard the top value. b
. Pop and print the top value.
@
, , a b b*9+a , 9, . .
If you try to verify this with another basic converter , make sure you understand it correctly. 332682811is a small drive, so you may need to cancel it.
source
share