summaryrefslogtreecommitdiff
path: root/tools/genlists.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-05 01:36:59 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-06 01:45:34 +0100
commit102b08d2b01959992d1e39b58d13386b9c458ea6 (patch)
tree30ee582c6f1137eecf51fe2c913e9892a14148d5 /tools/genlists.js
parentce86e2afb83461ccff20101884c39aeb3ff3b109 (diff)
downloadmaria-102b08d2b01959992d1e39b58d13386b9c458ea6.tar.gz
Automatically generated piece/power lists.
Diffstat (limited to 'tools/genlists.js')
-rw-r--r--tools/genlists.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/genlists.js b/tools/genlists.js
new file mode 100644
index 0000000..9ad1d91
--- /dev/null
+++ b/tools/genlists.js
@@ -0,0 +1,25 @@
+const all_powers = [ "france", "prussia", "pragmatic", "austria", "bavaria", "saxony" ]
+
+all_powers.forEach((pow,idx) => {
+ for (let type of [ "generals", "trains", "pieces" ]) {
+ console.log("const all_" + pow + "_" + type + " = all_power_" + type + "[P_" + pow.toUpperCase() + "]")
+ }
+})
+
+const all_combos = []
+
+for (let bit = 1; bit < 63; ++bit) {
+ let combo = []
+ for (let i = 0; i < 6; ++i)
+ if (bit & (1 << i))
+ combo.push(all_powers[i])
+ all_combos.push(combo)
+}
+
+for (let combo of all_combos) {
+ let name = combo.join("_")
+ console.log("const all_powers_" + name + " = [ " + combo.map(pow => "P_" + pow.toUpperCase()).join(", ") + " ]")
+ if (combo.length > 1)
+ for (let type of [ "generals", "trains", "pieces" ])
+ console.log("const all_" + name + "_" + type + " = [ " + combo.map(pow => "all_" + pow + "_" + type).join(", ") + " ].flat()")
+}