Questions tagged [befunge]

Befunge is a stack-based, reflective, esoteric programming language. It differs from conventional languages in that programs are arranged on a two-dimensional grid. "Arrow" instructions direct the control flow to the left, right, up or down, and loops are constructed by sending the control flow in a cycle. It has been described as "a cross between Forth and Lemmings."

Befunge is a stack-based, reflective, esoteric programming language. It differs from conventional languages in that programs are arranged on a two-dimensional grid. "Arrow" instructions direct the control flow to the left, right, up or down, and loops are constructed by sending the control flow in a cycle. It has been described as "a cross between Forth and Lemmings."

14 questions
5
votes
1 answer

Why does the Befunge code 9332682811>\#+:#*9-#\_$.@ output 52256370?

Today I tried to make an account on Esolangs.org, the esoteric programming languages wiki. I'd contributed to a few wikis before, and I had one or two minor page edits I wanted to contribute. ...that is, until I saw the CAPTCHA verification puzzle…
Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
5
votes
3 answers

Why is Befunge considered hard to compile?

One of the design goals of Befunge was to be hard to compile. However, it is quite easy to interpret. One can write an interpreter in a conventional language, say C. To translate a Befunge program to equivalent machine code, one can hard-code the…
Prateek
  • 2,377
  • 17
  • 29
4
votes
2 answers

How to pop Nth item in the stack [Befunge-93]

If you have the befunge program 321&,how would you access the first item (3) without throwing out the second two items? The instruction \ allows one to switch the first two items, but that doesn't get me any closer to the last one... The current…
Brian Hannay
  • 522
  • 4
  • 19
3
votes
3 answers

Generating a random number in Befunge

I want to generate a random number in Befunge, from 0 to n, where n is an arbitrary number. How would I go about doing this? I thought of trying this (this example has 2 chained chunks of code to show how it works): v v ?#>?#> 1 1 + + > ^> ^ and…
ASCIIThenANSI
  • 865
  • 1
  • 9
  • 27
1
vote
0 answers

Variables in Befunge

I'm coding in Befunge, and I wondered how I could make variables. I found that, using p and g, you can use your program to store variables. Example: >&&*11p ...do so ☺ m @.g11...gnihte This program asks the user two numbers,…
1
vote
1 answer

Way to import list of functions for Befunge-98 interpreter

I have found a really great Befunge interpreter, and am trying to add simple importing of fingerprints and their corresponding functions from a file. My current code uses classes for each of the functions, and then assigns the functions under a…
1
vote
2 answers

How to compile a program in Befunge-93?

How do I save and compile a program in Befunge-93? What file extension do I need to save the file as (like fileName.what)? Then how do I compile it?
David
  • 14,569
  • 34
  • 78
  • 107
1
vote
1 answer

Befunge RNG -- Why am I getting so many 2s?

Befunge isn't used much outside of code golf, but I wanted to try to learn it. I got a random number generator from Wikipedia and decided to modify it so that it ended. Here's what I have: v>>>>.v> ?^ 12345@ ^ ^ > ? ?^ v?v v6789> And I…
user1576628
  • 792
  • 3
  • 8
  • 25
1
vote
1 answer

What happens in Befunge if the execution reaches the limits of the program?

I couldn't find an answer to this question... Is there a "periodic boundary condition"? I.e. does the execution continue on the opposite site? Or is it illegal that the execution leaves the program?
steffen
  • 8,572
  • 11
  • 52
  • 90
0
votes
1 answer

Befunge program looping unexpectedly at @

I've got a befunge program that takes a number from the user, compares it to another number and if it is correct then outputs a "y" and exits (otherwise it loops back to the start). v < …
Jachdich
  • 782
  • 8
  • 23
0
votes
1 answer

Expand list of strings to 2D coordinate

I'm attempting to write a Befunge interpreter in Python, and my problem right now is the p command. Basically, I have a list of strings that are each line of the file and I use a 2D coordinate system to keep track of my position. The outer list is…
0
votes
1 answer

Befunge iterate multiple instructions

In Befunge-98, the k operator allows me to do this 1k12....@ The output of this will be 2110. I am looking for a (short) way to iterate multiple instructions, e.g. I want the output to be 2121 – as if the k operator iterated 12 twice, not just the…
Ingo Bürk
  • 19,263
  • 6
  • 66
  • 100
0
votes
1 answer

Befunge 98: eof from stdin

what is the expected behaviour for the ~ instruction in befunge-98, when EOF is encountered? Intuitively, it should place -1 on the stack, but I discovered some variation in this respect: the "intuitive" way is followed by the Befunge-93 JS…
alephreish
  • 490
  • 3
  • 15
-1
votes
1 answer

How does the instructor pointer work with a stack?

I recently read about a programming language called Befunge (esoteric programming language). It deals with operations with a stack. The Wikipedia article contains this text: The instruction pointer begins at a set location (the upper-left corner of…
dave j
  • 1
  • 1
  • 4