diff --git a/generate.py b/generate.py index ec42abb..d581cfa 100755 --- a/generate.py +++ b/generate.py @@ -135,9 +135,28 @@ network = Network( ), ) - -if __name__ == "__main__": - for __ in range(200): +def generate_text(number_of_lines = 100): + result = "" + for i in range(200): emissions, _ = network.choose() line = ''.join(emissions) - print(line) + result += line + "\n" + return result + +def read_template(filename = "./template.html"): + with open(filename, "r") as file: + return file.read() + +def write_index(text, filename = "./deploy/index.html"): + with open(filename, "w") as file: + file.write(text) + +def main(): + template = read_template() + generated = generate_text() + text = template.replace("", generated) + write_index(text) + +if __name__ == "__main__": + main() +