![]() # An empty board will be displayed, and the following commands are available: # E : Erase the board # R : Fill the board randomly # S : Step for a single generation # C : Update continuously until a key is struck # Q : Quit # Cursor keys : Move the cursor around the board # Space or Enter : Toggle the contents of the cursor's position # import sys import turtle import random CELL_SIZE = 10 # Measured in pixels class LifeBoard : """Encapsulates a Life board Attributes: xsize, ysize : horizontal and vertical size of the board state : set containing (x,y) coordinates for live cells. #!/usr/bin/env python3 # life.py - A turtle-based version of Conway's Game of Life. ![]() Therefore the pattern moves through the grid. Return to their initial configuration but in a different position, and Patterns are stable and don’t change over time at all spaceships For example, oscillators go through aĬycle of states and return to their initial state still life Pattern, and this one is called an oscillator.ĭescribes many such terms. Researchers in Life have coined many terms for different types of This pattern ends up in a cycle that repeats itself endlessly. Occur after starting with five live cells in a row. (The general term for a simulationĬarried out on a grid of cells and following some simple rules is aĬellular automaton.) For example, here are some patterns that These rules are simple and readily understandable, but they lead to ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |