git @ Cat's Eye Technologies ALPACA / 371cc07
More abstraction for output. Chris Pressey 7 years ago
1 changed file(s) with 13 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
121121 if options.divider != '':
122122 print options.divider
123123
124 count = 0
125 print_divider()
126 if options.show_initial:
124 def begin_output():
125 # TODO if not dumping to seperate files, then
126 print_divider()
127
128 def output_frame(count, pf):
129 # TODO if not dumping to seperate files, then
127130 print str(pf),
128131 print_divider()
132
133 count = 0
134 begin_output()
135 if options.show_initial:
136 output_frame(count, pf)
129137 while True:
130138 new_pf = Playfield(default_state, repr_map)
131139 evolve_playfield(pf, new_pf, ast, verbose=options.verbose)
134142 if pf.equals(new_pf):
135143 break
136144 pf = new_pf
145 count += 1
137146 if (options.show_intermediate or
138147 (options.generations is not None and
139148 count == options.generations - 1)):
140 print str(pf),
141 print_divider()
142 count += 1
149 output_frame(count, pf)
143150 if (options.generations is not None and
144151 count >= options.generations):
145152 break