about summary refs log tree commit diff
path: root/makeLayout.py
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2023-09-13 18:00:46 -0400
committerZach DeCook <zachdecook@librem.one>2023-09-13 18:00:46 -0400
commit27355d4cc0ad2188dbe699e9002a89d6b54b8c4b (patch)
tree0d3a4f8d558ddfd036f329ad3018e9fef27094a0 /makeLayout.py
parent328f3b148038ee4a6dedf1ba6e7a6a96c265b5fe (diff)
downloadHexBoard-27355d4cc0ad2188dbe699e9002a89d6b54b8c4b.tar.gz
Create python script to help create layouts
Diffstat (limited to 'makeLayout.py')
-rwxr-xr-xmakeLayout.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/makeLayout.py b/makeLayout.py
new file mode 100755
index 0000000..282625c
--- /dev/null
+++ b/makeLayout.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python3
+import sys
+
+evenCols=9
+oddCols=10
+rows=14
+
+def makeLayout(starting, across, downleft):
+    a = []
+    for row in range(0, rows):
+        a.append([])
+        for col in range(0, oddCols if row%2 else evenCols):
+            if row == 0 and col == 0:
+                a[row].append(starting)
+            elif col > 0:
+                a[row].append(a[row][col-1] + across)
+            else: # col == 0
+                if row%2:
+                    ref = a[row-1][0]
+                else:
+                    ref = a[row-1][1]
+                a[row].append(ref+downleft)
+    return a
+
+if __name__ == '__main__':
+    layout = makeLayout(int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]))
+    #print(layout)
+    row = 0
+    for Row in layout:
+        if row%2 == 0:
+            n = int(row/2)+1
+            print(f"  ROW_FLIP(CMDB_{n}, ", end='')
+        else:
+            print("        ROW_FLIP(", end='')
+        col = 1
+        for entry in Row:
+            end = ', ' if col < (oddCols if row%2 else evenCols) else ''
+            print(entry, end=end)
+            col = col + 1
+        print(')' if row +1 == rows else '),')
+        row = row + 1