langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
37
Task/Factorial/Piet/factorial.piet
Normal file
37
Task/Factorial/Piet/factorial.piet
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
push 1
|
||||
not
|
||||
in(number)
|
||||
duplicate
|
||||
not // label a
|
||||
pointer // pointer 1
|
||||
duplicate
|
||||
push 1
|
||||
subtract
|
||||
push 1
|
||||
pointer
|
||||
push 1
|
||||
noop
|
||||
pointer
|
||||
duplicate // the next op is back at label a
|
||||
|
||||
push 1 // this part continues from pointer 1
|
||||
noop
|
||||
push 2 // label b
|
||||
push 1
|
||||
rot 1 2
|
||||
duplicate
|
||||
not
|
||||
pointer // pointer 2
|
||||
multiply
|
||||
push 3
|
||||
pointer
|
||||
push 3
|
||||
pointer
|
||||
push 3
|
||||
push 3
|
||||
pointer
|
||||
pointer // back at label b
|
||||
|
||||
pop // continues from pointer 2
|
||||
out(number)
|
||||
exit
|
||||
Loading…
Add table
Add a link
Reference in a new issue