summaryrefslogtreecommitdiffstatshomepage
path: root/examples
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-01-06 22:13:00 +0000
committerJohn R. Lenton <jlenton@gmail.com>2014-01-07 22:51:08 +0000
commit1a9951d5aab681a4ff408d8520696b9f67b83d49 (patch)
treebd45b157eade73033cad4eb1336ec5357f881743 /examples
parentbe8fe5be2eb89cd8db741b16dcb50bf5966c33ae (diff)
downloadmicropython-1a9951d5aab681a4ff408d8520696b9f67b83d49.tar.gz
micropython-1a9951d5aab681a4ff408d8520696b9f67b83d49.zip
py: Fix up number operations and coercion.
Diffstat (limited to 'examples')
-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))