Sign inSign up

100hellos/befunge

By 100hellos

•Updated 4 months ago

"Hello World!" Written in befunge

Image
0

3.8K

100hellos/befunge repository overview

⁠Hello World! From befunge.

Language page⁠ — context, influences, and learning notes on the 100hellos site.

Source on GitHub⁠ (100hellos/befunge)

⁠Trying it

docker run --rm --platform="linux/amd64" 100hellos/befunge:latest

⁠Modifying it

Read the repo README⁠, or fork the project⁠ and customize it.

For an interactive shell:

docker run --rm --platform="linux/amd64" --entrypoint="" -it 100hellos/befunge:latest zsh

⁠Befunge

It is described as a cross between forth and lemmings wikipedia⁠, and yes... those lemmings! The grid based instruction set combined with a stack-based operation and dataframe, results in mind-melting awesomeness.

⁠Instruction List

0-9 	Push this number onto the stack.
+ 	Addition: Pop a and b, then push a+b
- 	Subtraction: Pop a and b, then push b-a
* 	Multiplication: Pop a and b, then push a*b
/ 	Integer division: Pop a and b, then push b/a, rounded towards 0.
% 	Modulo: Pop a and b, then push the remainder of the integer division of b/a.
! 	Logical NOT: Pop a value. If the value is zero, push 1; otherwise, push zero.
` 	Greater than: Pop a and b, then push 1 if b>a, otherwise zero.
> 	Start moving right
< 	Start moving left
^ 	Start moving up
v 	Start moving down
? 	Start moving in a random cardinal direction
_ 	Pop a value; move right if value=0, left otherwise
| 	Pop a value; move down if value=0, up otherwise
" 	Start string mode: push each character's ASCII value all the way up to the next "
: 	Duplicate value on top of the stack
\ 	Swap two values on top of the stack
$ 	Pop value from the stack and discard it
. 	Pop value and output as an integer followed by a space
, 	Pop value and output as ASCII character
# 	Bridge: Skip next cell
p 	A "put" call (a way to store a value for later use). Pop y, x, and v, then change the character at (x,y) in the program to the character with ASCII value v
g 	A "get" call (a way to retrieve data in storage). Pop y and x, then push ASCII value of the character at that position in the program
& 	Ask user for a number and push it
~ 	Ask user for a character and push its ASCII value
@ 	End program

Tag summary

Content type

Image

Digest

sha256:98583a105…

Size

88.5 MB

Last updated

4 months ago

docker pull 100hellos/befunge