summaryrefslogtreecommitdiffstatshomepage
path: root/examples/mandel.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-01-06 22:13:00 +0000
committerDamien George <damien.p.george@gmail.com>2014-01-06 22:13:00 +0000
commite2e3d11e8744395d3103b824adc8609b13f2cdba (patch)
tree680bb38dac6c65722b38866d7d17befae0edb7af /examples/mandel.py
parent8137b004b004d8e3a594eab90afccb72b779273a (diff)
downloadmicropython-e2e3d11e8744395d3103b824adc8609b13f2cdba.tar.gz
micropython-e2e3d11e8744395d3103b824adc8609b13f2cdba.zip
py: Fix up number operations and coercion.
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))