Path

From Esolang
Jump to navigation Jump to search
Not to be confused with PATH.

Path is a two-dimensional esoteric programming language invented by User:masalt in Python 3.

Instructions

Path has the following instructions:

Instruction Definition
Faces pointer north or east, depending on the direction beforehand (unless it's facing either already).
Faces pointer north or west, depending on the direction beforehand (unless it's facing either already).
Faces pointer south or west, depending on the direction beforehand (unless it's facing either already).
Faces pointer south or east, depending on the direction beforehand (unless it's facing either already).
Faces the pointer north (if it's not already).
Faces the pointer south (if it's not already).
Faces the pointer east (if it's not already).
Faces the pointer west (if it's not already).
? Faces the pointer in a random direction.
Continues moving the pointer vertically.
Continues moving the pointer horizontally.
Continues moving the pointer vertically or horizontally.
Reverses the pointer's direction.
+ Increases top of stack.
- Decreases top of stack.
& Pushes 0 to the stack.
$ Pops top of stack.
~ Takes user input (string) and pushes the character ascii value to the stack.
# Takes user input (integer) and pushes the value to the stack.
: Duplicates the top stack value.
. Caches the top stack value and pop it.
, Caches the ascii character of top stack value and pop it.
% Swaps the top two stack values.
^ Faces the pointer north of the top stack value is greater than the second.
v Faces the pointer south of the top stack value is greater than the second.
> Faces the pointer east of the top stack value is greater than the second.
< Faces the pointer west of the top stack value is greater than the second.
J Joins the top two stack values (B;A)
j Joins the top two stack values (A;B)
p Prints cache.
g Pops the top stack value and adds that item of the stack stack (from back).
r Takes the top two stack values (A,B) and replaces item of A stack with B.
w Takes the top stack value (A) and waits for a seconds.
q Takes the top stack value (A) and caches line A of the code.
0-9 Pushes number at pointer to the stack.
× Pops the the top two stack values and pushes their product to the stack.
÷ Pops the the top two stack values and pushes the rounded quotient to the stack.
± If the proceeding instruction is +, pushes the sum of the top two values; If the proceeding instruction is -, pushes the difference of the top two values (B-A). Skips next instruction (+,-).
= If the top two values are equivilant, pushes 0, otherwise pushes 1.
@ Ends the program and print all cache.

Examples

Quine

q@

Cat Program

┬,┐
└~┘

Hello, World!

1q@
Hello, World!

Truth Machine

#1─v┬─p┐
@.$┘└:.┘

Fibonacci Sequence

1.p1.p11┬w9p.:+±┐
        └±+:.p9w┘

Disan Count

#&┬p.:┐
  └++v┘
     @

99 Bottles of Beer

99J┬─ppq4$v2.:-pq6─┐
   └──:.3q┼p:.5qp──┘
          └-8qpp─:.7qp:.9qp6qp10Jqp@
 bottles of beer on the wall,
 bottles of beer on the wall.
 bottles of beer.
Take one down, pass it around,
 bottle of beer on the wall,
 bottle of beer on the wall.
 bottle of beer.
No bottles of beer on the wall.

Deadfish Implementation

┐       ┌$$$┐
├256JJ=1^┐  ├~:001jj±-&-%v$$$$:501jj±-&-%v$$$$:111jj±-&-%v$$$$:115JJ±-&-%v┐
│      ┌─┘  0  ┌-$v1$$$$$┘               │               │               ││
│      └$$$$┘  │  │                      │               │               ││
└──────────────┤  └─$─$─0─┬────────+$$$$$┘               │               ││
               └──────────┤            ┌─────────p.:$$$$$┘               ││
                          └────────────┤               ┌──────────×:$$$$$┘│
                                       └───────────────┤                  │
                                                       └─────────────$$$$$┘

Implementations

The official Path interpreter.