Mercurial > public > think_complexity
diff ch7ex2.py @ 48:98eb01502cf5 tip
Follow up to last commit. Re-orient the r-pentomino. Added progress display.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 31 Jul 2013 20:37:12 -0500 |
parents | 2b0e229e163c |
children |
line wrap: on
line diff
--- a/ch7ex2.py Thu Jul 25 21:53:44 2013 -0500 +++ b/ch7ex2.py Wed Jul 31 20:37:12 2013 -0500 @@ -11,14 +11,16 @@ class RPentomino(Life.Life): def __init__(self, n): - super(RPentomino, self).__init__(n, mode='constant', cval=0, random=False) + super(RPentomino, self).__init__(n, mode='constant', cval=0, + random=False, show_progress=10) i, j = n / 2, n / 2 self.array[i, j] = 1 self.array[i, j - 1] = 1 - self.array[i, j + 1] = 1 + self.array[i + 1, j] = 1 + self.array[i + 1, j + 1] = 1 self.array[i - 1, j] = 1 - self.array[i + 1, j - 1] = 1 + if __name__ == '__main__': life = RPentomino(150)