From bd466aa98a25f1a4d5689ae868ab9e8c9ea4ea3b Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 12 May 2024 10:13:02 +0100 Subject: Another example --- examples/dragon.fco | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 examples/dragon.fco (limited to 'examples/dragon.fco') 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 -- cgit v1.2.3