summaryrefslogtreecommitdiff
path: root/tools/genlists.js
blob: 9ad1d915e8ae7f11b46d768b8746554524c01627 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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()")
}