Created
December 9, 2015 21:00
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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