pep8 fixes
Rafael Ortiz
13 years ago
3 | 3 | import os |
4 | 4 | import time |
5 | 5 | import random |
6 | ||
6 | 7 | |
7 | 8 | def LoadCells(rows, cols): |
8 | 9 | """ We need a function to load cells in the neighborhood """ |
19 | 20 | grid[x][y] = cell |
20 | 21 | return grid |
21 | 22 | |
23 | ||
22 | 24 | def DrawGrid(grid): |
23 | 25 | """ Here we draw the grid """ |
24 | 26 | rows = len(grid) |
30 | 32 | else: |
31 | 33 | print 'o', |
32 | 34 | print '\n', |
35 | ||
33 | 36 | |
34 | 37 | def CountNeighbors(grid, x, y): |
35 | 38 | """ Count neighbors arround a single cell""" |
57 | 60 | |
58 | 61 | return neighbors |
59 | 62 | |
63 | ||
60 | 64 | def Iteration(grid): |
61 | 65 | """ here we define a single iteration |
62 | 66 | if we have between 3 and 6 neighbors the single cell lives |
75 | 79 | if neighbors == 3: |
76 | 80 | grid[x][y] = 1 |
77 | 81 | |
82 | ||
78 | 83 | def Iterator(rows, cols, pulses): |
79 | 84 | """ Iterate n pulses and draws the result of each one """ |
80 | 85 | pulse = 1 |