summaryrefslogtreecommitdiffstatshomepage
path: root/examples/mandel.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/mandel.py')
-rw-r--r--examples/mandel.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/mandel.py b/examples/mandel.py
new file mode 100644
index 0000000000..b13b7d87f8
--- /dev/null
+++ b/examples/mandel.py
@@ -0,0 +1,14 @@
+@micropython.native
+def in_set(c):
+ z = 0
+ for i in range(40):
+ z = z*z + c
+ if abs(z) > 60:
+ return False
+ return True
+
+for v in range(31):
+ line = []
+ for u in range(91):
+ line.append('*' if in_set((u / 30 - 2) + (v / 15 - 1) * 1j) else ' ')
+ print(''.join(line))