aboutsummaryrefslogtreecommitdiff
path: root/examples/dragon.fco
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2024-05-12 10:13:02 +0100
committerJuan J. Martinez <jjm@usebox.net>2024-05-12 10:13:26 +0100
commitbd466aa98a25f1a4d5689ae868ab9e8c9ea4ea3b (patch)
tree41ec01c93bf45efe6ff851fd32ea3dda67abd0d9 /examples/dragon.fco
parent6dfd8a16ff7482fb1a84f69ad4748513e452ff9d (diff)
downloadfunco-bd466aa98a25f1a4d5689ae868ab9e8c9ea4ea3b.tar.gz
funco-bd466aa98a25f1a4d5689ae868ab9e8c9ea4ea3b.zip
Another example
Diffstat (limited to 'examples/dragon.fco')
-rw-r--r--examples/dragon.fco13
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/dragon.fco b/examples/dragon.fco
new file mode 100644
index 0000000..1240bf0
--- /dev/null
+++ b/examples/dragon.fco
@@ -0,0 +1,13 @@
+# Generates the sequence of turns needed to draw a dragon curve;
+# see: http://en.wikipedia.org/wiki/Dragon_curve
+def dragon(n turns)
+ if =(n 0)
+ ""
+ else
+ +(+(dragon(-(n 1) "R") turns) dragon(-(n 1) "L"))
+ end
+end
+
+def main()
+ display(dragon(5 ""))
+end