Codebase list sugar-pippy-activity / 0af8769
pep8 fixes Rafael Ortiz 13 years ago
1 changed file(s) with 5 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
33 import os
44 import time
55 import random
6
67
78 def LoadCells(rows, cols):
89 """ We need a function to load cells in the neighborhood """
1920 grid[x][y] = cell
2021 return grid
2122
23
2224 def DrawGrid(grid):
2325 """ Here we draw the grid """
2426 rows = len(grid)
3032 else:
3133 print 'o',
3234 print '\n',
35
3336
3437 def CountNeighbors(grid, x, y):
3538 """ Count neighbors arround a single cell"""
5760
5861 return neighbors
5962
63
6064 def Iteration(grid):
6165 """ here we define a single iteration
6266 if we have between 3 and 6 neighbors the single cell lives
7579 if neighbors == 3:
7680 grid[x][y] = 1
7781
82
7883 def Iterator(rows, cols, pulses):
7984 """ Iterate n pulses and draws the result of each one """
8085 pulse = 1