Drawing with bit operations

import matplotlib.pyplot as plt xs, ys = [], [] iterations = 100 x = 10 for i in range(iterations): y = ((i & 6) & (x | 3)) & ((x | (x << 1)) << 1) ^ (50-i) xs.append(x) ys.append(y) x += 1 plt.plot(xs, ys, 'k-',lw=2) xs, ys = [], [] x = 0 for i in range(iterations): y = ((i & 10) & (x | 5)) ^ (((x ^ i//3)) ^ (x & i//50)) xs.append(x) ys.append(y) x += 1 plt.plot(xs, ys, 'r-',lw=2) plt.axis('off') plt.tight_layout() plt.show() Drawing with bit operations

We could use bit operations to create various space-filling curves, z-curves, dragon curves and other shapes that look as if created by non-trivial algorithms.