Created
May 3, 2020 01:37
-
-
Save shawntan/68aacf4faf732fa9bc1f39bf6fd9ce4b to your computer and use it in GitHub Desktop.
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
| rules = {'xxx': ' ','xx ': ' ', 'x ': 'x','x x':' ',' xx':'x',' x ':'x', ' x': 'x', ' ':' '} | |
| initial_string = " " * 100 + "x" + " " * 100 | |
| prev_string = initial_string | |
| for i in range(90): | |
| print(prev_string) | |
| prev_string = ''.join(rules.get(prev_string[i - 1:i + 2], ' ') for i in range(len(initial_string))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment