More abstraction for output.
Chris Pressey
7 years ago
121 | 121 | if options.divider != '': |
122 | 122 | print options.divider |
123 | 123 | |
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 | |
127 | 130 | print str(pf), |
128 | 131 | print_divider() |
132 | ||
133 | count = 0 | |
134 | begin_output() | |
135 | if options.show_initial: | |
136 | output_frame(count, pf) | |
129 | 137 | while True: |
130 | 138 | new_pf = Playfield(default_state, repr_map) |
131 | 139 | evolve_playfield(pf, new_pf, ast, verbose=options.verbose) |
134 | 142 | if pf.equals(new_pf): |
135 | 143 | break |
136 | 144 | pf = new_pf |
145 | count += 1 | |
137 | 146 | if (options.show_intermediate or |
138 | 147 | (options.generations is not None and |
139 | 148 | count == options.generations - 1)): |
140 | print str(pf), | |
141 | print_divider() | |
142 | count += 1 | |
149 | output_frame(count, pf) | |
143 | 150 | if (options.generations is not None and |
144 | 151 | count >= options.generations): |
145 | 152 | break |