Permalink
Browse files

Allow world shapes to be chosen with arguments

  • Loading branch information...
1 parent 0630ba9 commit d545bb0e1e7bb12a398a666c2a35d47c1f602ff3 @ejs committed Sep 19, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 gameoflife.py
View
@@ -116,9 +116,15 @@ def display(self):
if __name__ == '__main__':
+ import optparse
#world = ComplexWorld((1+1j), (2+2j), (3+3j), (2+3j))
- #world = World((1, 1), (2, 2), (3, 3), (2, 3))
- world = ToridLife((4, 4), (1, 1), (2, 2), (3, 3), (2, 3))
+
+ parser = optparse.OptionParser()
+ parser.add_option('-i', dest='world', action='store_const', const=World, default=World)
+ parser.add_option('-t', dest='world', action='store_const', const=ToridLife)
+ options, args = parser.parse_args()
+
+ world = options.world((4, 4), (1, 1), (2, 2), (3, 3), (2, 3))
for i in range(10):
if not len(world):
break

0 comments on commit d545bb0

Please sign in to comment.