{ "cells": [ { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true, "toc": "true" }, "source": [ "# Table of Contents\n", "
" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "# Obfuscated code or piece of art?\n", "\n", "This short notebooks shows a few examples of Python code, designed to draw something, and shaped as what they will draw..." ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "## Mandelbrot set\n", "\n", "This nice little code will write a visualization of the [Mandelbrot set](https://en.wikipedia.org/wiki/Mandelbrot_set), on the domain $[-3, 3] \\times [-3i, 3i]$, for $1500 \\times 1500$ points, as a Bitmap (written manually in binary)." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/usr/local/lib/python2.7/dist-packages/ipykernel/__main__.py:20: DeprecationWarning: integer argument expected, got float\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 3min 43s, sys: 296 ms, total: 3min 44s\n", "Wall time: 3min 43s\n" ] } ], "source": [ "%%time\n", "b_ = (\n", " 255,\n", " lambda\n", " V ,B,c\n", " :c and Y(V*V+B,B, c\n", " -1)if(abs(V)<6)else\n", " ( 2+c-4*abs(V)**-0.4)/i\n", " ) ;v, x=1500,1000;C=range(v*x\n", " );import struct;P=struct.pack;M,\\\n", " j ='