Skip to content

Commit

Permalink
added some more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
thearn committed Feb 28, 2014
1 parent 28ea91d commit cfca452
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ $ python replicator.py

Other cellular automata implementations in the top-level directory are run the same way.

Alternatively, a general-purpose neighbor-oriented automata state transition function is also available. This will take an array encoding the current state (see below) along with a [rule string](http://www.conwaylife.com/wiki/Cellular_automaton#Rules), and outputs
the next state for all cells. `rule_string.py`
shows how to use this.

End each program using a keyboard interrupt (ctrl-c).

How it's written
Expand Down
5 changes: 5 additions & 0 deletions rule_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
import numpy as np
import time

# game board size
m,n = 100,100

# uncomment any of the rule string and
# initial state arrays (A) below to see each
# automata

# Game of Life
rule_string = 'B36/S23'
A = np.random.random(m*n).reshape((m, n)).round()
Expand Down

0 comments on commit cfca452

Please sign in to comment.