Pth

From Esolang
Jump to navigation Jump to search

Pth is a dedicated declarative path-finding language invented by User:A created in order to make path-finding challenges on CGCC very trivial.

Example program

In Pth the indexing operation has a higher priority than other operators.

# For each item in the input
i-1& # The transition may be decrement the number
i+1 # Or Increment the number.
# Rules:
i>9 i←9.\ # If the item at i is larger than 9, set that item to 0;
i<0 i←9.\ # If the item at i is less than 0, set that item to 9;
!t<10³ # The time must be less than 1000 steps.
# Main procedure:
# Find the path of
α ñ β # Input 1 transitioned to input 2
# that makes the time the least.

Condensed:

i-1&i+1
i>9 i←0.i<0 i←9.!t<10³
αñβ

Condensed:

iω&iζ
iεi←0.iΌi←9.!t<χ³
αñβ
  • &: Return the index that the current position is in.