<commit_before>import math
import model
import sys
import util


class ConsoleApp:
	def __init__(self, argc, argv):
		# Command line arguments
		if argc != 2 or int(argv[1]) <= 0:
			self.print_usage(argv)
			exit()
		self.max_generation = int(argv[1])
		self.is_running = False
		self.size = (1024, 768)
		self.model = None
 
 	def print_usage(self, argv):
 		""" Print command line argument info to standard output """
 		print "usage: python %s max_generation" % argv[0]

	def on_init(self):
		""" Nothing to do """
		pass

	def on_execute(self):
		""" Run the simulation until the user quits or reach max_generation """
		self.is_running = True
		self.model = model.Model(self.size)

		while(self.is_running):
			self.model.on_tick()
			if self.model.generation == self.max_generation + 1:
				self.is_running = False

	def on_exit(self):
		""" Model outputs results """
		self.model.on_exit()


if __name__ == "__main__" :
	app_instance = ConsoleApp(len(sys.argv), sys.argv)
	app_instance.on_init()
	app_instance.on_execute()
	app_instance.on_exit()
<commit_msg>console_driver outputs current generation<commit_after>import math
import model
import sys
import util


class ConsoleApp:
	def __init__(self, argc, argv):
		# Command line arguments
		if argc != 2 or int(argv[1]) <= 0:
			self.print_usage(argv)
			exit()
		self.max_generation = int(argv[1])
		self.is_running = False
		self.size = (1024, 768)
		self.model = None
 
 	def print_usage(self, argv):
 		""" Print command line argument info to standard output """
 		print "usage: python %s max_generation" % argv[0]

	def on_init(self):
		""" Nothing to do """
		pass

	def on_execute(self):
		""" Run the simulation until the user quits or reach max_generation """
		self.is_running = True
		self.model = model.Model(self.size)
		current_generation = 0

		while(self.is_running):
			self.model.on_tick()
			if self.model.generation != current_generation:
				print "generation %d" % self.model.generation
				current_generation = self.model.generation
			if self.model.generation == self.max_generation + 1:
				self.is_running = False

	def on_exit(self):
		""" Model outputs results """
		self.model.on_exit()


if __name__ == "__main__" :
	app_instance = ConsoleApp(len(sys.argv), sys.argv)
	app_instance.on_init()
	app_instance.on_execute()
	app_instance.on_exit()

{'fraction_non_alphanumeric': 0.12119914346895075, 'fraction_numerical': 0.011563169164882228, 'mean_word_length': 4.0344827586206895, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '869474', 'n_tokens_mistral': 886, 'n_tokens_neox': 770, 'n_words': 206}