From 72c46d547eeee2fe7700ec2dbbb97b9c0f67a373 Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Wed, 14 Sep 2022 22:11:44 +0200 Subject: Added a few scripts to parse the large pattern file of game of life patterns and also added the functionality to scroll through the list and it affects the current world --- presets/parse.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 presets/parse.py (limited to 'presets/parse.py') diff --git a/presets/parse.py b/presets/parse.py new file mode 100755 index 0000000..fb06bce --- /dev/null +++ b/presets/parse.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + + +with open("/home/pengu/test/rust-dev/gof-rs/presets/patterns-striped.txt", "r") as file: + with open("./new.txt", "w") as newfile: + cnt = 0 + for line in file.readlines(): + if line != '\n': + if cnt > 0: + newfile.write("\n") + if len(line) < 73 and line != '\n': + txt = line.rstrip().center(72, ".") + '\n' + newfile.write(txt) + cnt = 0 + if line == '\n': + cnt += 1 + -- cgit v1.2.3