diff options
Diffstat (limited to 'tetris/utility.prn')
-rw-r--r-- | tetris/utility.prn | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tetris/utility.prn b/tetris/utility.prn index ca68dfe..3a4b912 100644 --- a/tetris/utility.prn +++ b/tetris/utility.prn @@ -1,3 +1,12 @@ +@defun "add2" { + "y2" store + "x2" store + "y1" store + "x1" store + x1 x2 + + y1 y2 + +} + @defun "diff2" { "y2" store "x2" store @@ -13,6 +22,14 @@ a b a b } +@defun "dup4" { + "d" store + "c" store + "b" store + "a" store + a b c d a b c d +} + @defun "swap2" { "b2" store "b1" store @@ -20,3 +37,15 @@ "a1" store b1 b2 a1 a2 } + +@defun "replicate" { #args: value times + dup 1 < if + pop pop + else + 1 - "t" store + t 0 > while + dup + t 1 - "t" store + t 0 > end + end +} |