Skip to content

Instantly share code, notes, and snippets.

@FilipDominec
Created December 9, 2015 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FilipDominec/35269f4be5058ea3a72a to your computer and use it in GitHub Desktop.
Save FilipDominec/35269f4be5058ea3a72a to your computer and use it in GitHub Desktop.
Stephen Wolfram's chaos generator based on the https://en.wikipedia.org/wiki/Rule_30
#!/usr/bin/env python
# -*- coding: utf -*-
S = "-"*70 + u"█" + "-"*80
for x in range(100):
print S
Q = "-"
for l in range(1, len(S)-1):
a, b, c = S[l-1]==u"█", S[l]==u"█", S[l+1]==u"█"
if (a and not b and not c) or (not a and b and not c) or (not a and not b and c) or (not a and b and c):
Q = Q+u"█"
else:
Q = Q+"-"
Q = Q+"-"
S = Q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment