-
Notifications
You must be signed in to change notification settings - Fork 0
Instructions
Patternizer v0.18
For non-communative operations, the operation is performed on the second popped number using the first (a b - is a - b).
-
0 1 2 3
Any number by itself pushes that number to the stack. Floating point numbers are also accepted. -
+
Pops two numbers, adds them, and pushes the result. -
-
Pops two numbers, subtracts them, and pushes the result. -
*
Pops two numbers, multiplies them, and pushes the result. -
/
Pops two numbers, divides them, and pushes the result. -
%
Pops two numbers, takes the modulus of them, and pushes the result. -
floor
Pops a number and pushes the floor of that number. -
ceil
Pops a number and pushes the ceiling of that number. -
abs
Pops a number and pushes the absolute value of that number. -
rnd
Pops two numbers and picks a random integer within their range. Both inputs must be integers. The number popped first is the upper bound and the second is the lower bound.
Before and after snapshots of the stack are shown as ( <before> - <after> )
-
dup
Duplicates the top value of the stack.
( a - a a ) -
drop
Deletes the top value of the stack.
( a - ) -
swap
Swaps the top two values of the stack.
( a b - b a ) -
over
Duplicates the value under the value on top of the stack.
( a b - a b a ) -
roll
Pops two numbers: The first value popped is the number of times to roll the stack and the second is the depth. A negative depth value will start indexing from the bottom of the stack. A negative roll value will roll the stack in the opposite direction. If either argument is 0, nothing happens.
( a b c d 4 1 - b c d a )
( a b c d 3 1 - a c d b )
( a b c d 3 -1 - a d b c )
( a b c d -1 1 - b c d a )
Boolean operators push 1 if true, 0 if false. Any number that is not 0 is true.
-
==
Equality. -
!=
Inequality. -
>
Greater than. -
>=
Greater than or equal to. -
<
Less than. -
<=
Less than or equal to.
-
or
Logical or. -
and
Logical and. -
not
Logical not.
-
while <statements> end
Pops a value. If it's false, skip to the instruction afterend, otherwise run the statements. When the statements are done, pop another value and perform a check and repeat as described. (This can be used to flush the stack until a 0 is reached.) -
for <statements> end
Duplicates and pops a value. If it's false, drop the value on top of the stack and jump to the instruction afterend. If it's true, decrement the value by 1 and push it back to the stack and enter the loop. When the statements are done, duplicate and pop another value and repeat as described. -
if <statements> end
Pops a value. If it's true, the statements are run. -
if <statements> else <statements> end
Pops a value. If it's true, the statements within the first set is run, otherwise the second set is run. -
return
Stops the program. The stack is the output.
-
$sides
Pushes the current side count to the stack. -
$hsides
Pushes the current side count divided by 2 (unrounded). -
$th
PushesTHICKNESSto the stack. -
$idealth
Pushes the ideal thickness to the stack. -
$idealdl
Pushes the ideal delay to the stack. -
$sperpr
Pushes the seconds per player rotation. -
$abs
Pushes the absolute pivot to the stack. Initialized to a random side [0,$sides). -
$rel
Pushes the relative pivot to the stack. Initialized to 0. -
$rof
Pushes the relative offset to the stack. Initialized to 0. -
$mirror
Pushes the mirror value to the stack (either 1 or -1). Initialised to 1 or -1. -
$tolerance
Pushes the tolerance to the stack. Initialized to 4.
-
rmv
Pops the top value of the stack and moves the relative pivot by that amount. Also updates the relative offset. This is the preferred method to modify the relative pivot.Equivalent to:
dup abs dup $sides $hsides 3 1 roll < if swap - else drop end =rof $mirror * $rel + $sides % -
a
Pushes the absolute position (for consistency).Equivalent to:
$abs -
r
Pushes the true relative position.Equivalent to:
$abs $rel + $sides %
-
i
Converts units of ideal thickness to absolute thickness.Equivalent to
$idealth * -
spath
Pushes the short path thickness.Equivalent to:
$rof i -
lpath
Pushes the long path thickness.Equivalent to:
$sides $rof - i -
th2s
Converts an absolute thickness value to seconds. -
s2th
Converts a seconds value to absolute thickness.
-
h:<pattern>
Pops the top two numbers on the stack. The first number is the position; the second is the absolute thickness. Adds a wall creation event to the timeline. -
t:<pattern>
Same as above but adds the tolerance value to the thickness. -
p:<pattern>
Same as above but also delays the timeline by the amount of time it takes for the wall to travel its full thickness. (This delay ignores the tolerance value.) Generally the default choice for generating patterns. -
sleep
Accepts a duration in seconds and adds a wait event to the timeline. -
thsleep
Accepts a thickness and waits the coresponding amount of seconds.Equivalent to:
th2s sleep -
rsleep
Waits the amount of time it would take for the player to rotate a certain number of revolutions.Equivalent to:
$sperpr * sleep -
call:<char>
Creates a function event for the first character after the colon. First, a number is popped to indicate how many arguments the function should recieve. Then that many numbers are popped and saved for later use with the function call. Arguments are passed to the function in the reverse order in which they were popped i.e. the first popped number is the last argument of the called function and vice versa.
-
#restrict
A preprocessor flag that separates the main body of code and a restrict expression. This is used by Patternizer's pattern spawner to decide whether a pattern should or should not be spawned. See more in Stackup and Patternizer.
The information presented in this wiki is not guaranteed to be accurate. The information presented may be a few versions old.