aboutsummaryrefslogtreecommitdiff
path: root/presets/scripts/force42Height.py
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2022-09-14 23:30:46 +0200
committeromagdy7 <omar.professional8777@gmail.com>2022-09-14 23:30:46 +0200
commitb0d4f79820eecafadaffc443df57eb0d18872b9e (patch)
tree3b449d608f2b1ad6d6530fb34429ee12aff819d4 /presets/scripts/force42Height.py
parent038ef83ec9c57add1d53202bfdb9cf141b6dc6ab (diff)
downloadgof-rs-b0d4f79820eecafadaffc443df57eb0d18872b9e.tar.xz
gof-rs-b0d4f79820eecafadaffc443df57eb0d18872b9e.zip
Added all patterns to the code and made that you could select between them with j and k and animate them with a and stop the animation with s
Diffstat (limited to 'presets/scripts/force42Height.py')
-rwxr-xr-xpresets/scripts/force42Height.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/presets/scripts/force42Height.py b/presets/scripts/force42Height.py
new file mode 100755
index 0000000..845252e
--- /dev/null
+++ b/presets/scripts/force42Height.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python3
+
+import os
+
+path = "/home/pengu/test/rust-dev/gof-rs/presets/dir/patterns"
+newpath = "/home/pengu/test/rust-dev/gof-rs/presets/dir/newpatterns"
+
+os.chdir(path)
+
+def get_file_lines(file):
+ cnt = 0
+ with open(f"{path}/{file}", "r") as file:
+ for _ in file.readlines():
+ cnt += 1
+ return cnt
+
+cnt = 0
+for file in os.listdir():
+ cnt += 1
+ lines = 42 - get_file_lines(file)
+ upper = 0
+ lower = 0
+ if lines % 2 == 0:
+ upper = lines // 2
+ lower = lines // 2
+ else:
+ upper = lines // 2
+ lower = upper + 1
+ with open(f"{path}/{file}", "r") as r:
+ with open(f"{newpath}/pattern{cnt}.txt", "w") as w:
+ for _ in range(upper):
+ w.write("........................................................................\n")
+ for line in r.readlines():
+ w.write(line)
+ for _ in range(lower):
+ w.write("........................................................................\n")
+
+
+
+
+
+