We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Gridify

From Esolang
Jump to navigation Jump to search

Gridify is an esolang by User:Cordership based on Befunge.

Instructions

Instruction Definition
> Move code pointer right.
< Move code pointer left.
^ Move code pointer up.
v Move code pointer down.
~ Input a character and push it into the stack.
& Input an integer and push it into the stack.
. Pop the number at the top of the stack, output it as an integer.
, Pop the number at the top of the stack, output it as an ASCII character.
_ Horizontal If: Pop top of stack, go left if value=0, otherwise go right.
| Vertical If: Pop top of stack, go up if value=0, otherwise go down.
` Horizontal If 2: Pop top of stack, go right if value=0, otherwise go left.
x Vertical If 2: Pop top of stack, go down if value=0, otherwise go up.
? All-directions If: Pop top of stack, if value=1 go up, if value=2 go down, if value=3 go left, if value=4 go right.
[int] Push number into the stack.
"[string]" Push string into the stack.
@ Halt program.
: Pop top of the stack at the code pointer and store it in the code pointer.
; Push the code pointer's contents into the stack at the code pointer.
+ Pop the two topmost numbers a and b in the stack, push the result of a+b.
- Pop the two topmost numbers a and b in the stack, push the result of a-b.
* Pop the two topmost numbers a and b in the stack, push the result of a*b.
/ Pop the two topmost numbers a and b in the stack, push the result of a/b.
% Pop the two topmost numbers a and b in the stack, push the remainder of the integer division a/b.
^ Pop the two topmost numbers a and b in the stack, push the result of a^b.
# Discard the code pointer's contents.
\*text*\ One-line comment.
$ Pop top of the stack at the code pointer, duplicate it: one copy gets pushed back into the stack, the other goes into the code pointer.
w Pop the code pointer's contents, duplicate it: one copy goes into the stack, the other stays in the code pointer.
s Starts code execution.
k Pop the two topmost numbers a and b in the stack, push a into the stack b times.
n Pop all of the stack's contents and print them from top to bottom as integers.
r Pop all of the stack's contents and print them from top to bottom as ASCII characters.
o Increment the code pointer's contents by 1.
a Duplicate top stack value.
p Skip the command right ahead of the code pointer in its direction.
\ Swap top stack values.
z Move the code pointer in a random direction.
  1. Everything else is NOP.
  2. If the pointer or the memory cell at the pointer is storing a string, the +, *, and ^ commands don't work.
  3. The code execution starts at the leftmost input command or the s command then moves right by default.

Programs

Hello, World!

s"!dlroW ,olleH">  v
                ^!a`@

Hello, World! 2

s72!101!108!108!111!44!32!87!111!114!108!100!33!@

Hello, World! 3

s"!dlroW ,olleH"r@

One time cat

,.

Cat program

,>.,v
 ^  _@

Truth-machine

This one infinitely prints every user input except 0.

 >0.@
,|
 >.,v
 ^  <

A+B problem

&&+.

Looping counter

s42 0:>owkr10,v
      ^       <