From 102b08d2b01959992d1e39b58d13386b9c458ea6 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 5 Nov 2024 01:36:59 +0100 Subject: Automatically generated piece/power lists. --- rules.js | 411 +++++++++++++++++++++++++++++++++++++----------------- tools/genlists.js | 25 ++++ 2 files changed, 309 insertions(+), 127 deletions(-) create mode 100644 tools/genlists.js diff --git a/rules.js b/rules.js index 97ebc9d..1ec17ab 100644 --- a/rules.js +++ b/rules.js @@ -267,6 +267,257 @@ function to_value(c) { return c & 15 } +/* DATA (LISTS) */ + +const all_france_generals = all_power_generals[P_FRANCE] +const all_france_trains = all_power_trains[P_FRANCE] +const all_france_pieces = all_power_pieces[P_FRANCE] +const all_prussia_generals = all_power_generals[P_PRUSSIA] +const all_prussia_trains = all_power_trains[P_PRUSSIA] +const all_prussia_pieces = all_power_pieces[P_PRUSSIA] +const all_pragmatic_generals = all_power_generals[P_PRAGMATIC] +const all_pragmatic_trains = all_power_trains[P_PRAGMATIC] +const all_pragmatic_pieces = all_power_pieces[P_PRAGMATIC] +const all_austria_generals = all_power_generals[P_AUSTRIA] +const all_austria_trains = all_power_trains[P_AUSTRIA] +const all_austria_pieces = all_power_pieces[P_AUSTRIA] +const all_bavaria_generals = all_power_generals[P_BAVARIA] +const all_bavaria_trains = all_power_trains[P_BAVARIA] +const all_bavaria_pieces = all_power_pieces[P_BAVARIA] +const all_saxony_generals = all_power_generals[P_SAXONY] +const all_saxony_trains = all_power_trains[P_SAXONY] +const all_saxony_pieces = all_power_pieces[P_SAXONY] +const all_powers_france = [ P_FRANCE ] +const all_powers_prussia = [ P_PRUSSIA ] +const all_powers_france_prussia = [ P_FRANCE, P_PRUSSIA ] +const all_france_prussia_generals = [ all_france_generals, all_prussia_generals ].flat() +const all_france_prussia_trains = [ all_france_trains, all_prussia_trains ].flat() +const all_france_prussia_pieces = [ all_france_pieces, all_prussia_pieces ].flat() +const all_powers_pragmatic = [ P_PRAGMATIC ] +const all_powers_france_pragmatic = [ P_FRANCE, P_PRAGMATIC ] +const all_france_pragmatic_generals = [ all_france_generals, all_pragmatic_generals ].flat() +const all_france_pragmatic_trains = [ all_france_trains, all_pragmatic_trains ].flat() +const all_france_pragmatic_pieces = [ all_france_pieces, all_pragmatic_pieces ].flat() +const all_powers_prussia_pragmatic = [ P_PRUSSIA, P_PRAGMATIC ] +const all_prussia_pragmatic_generals = [ all_prussia_generals, all_pragmatic_generals ].flat() +const all_prussia_pragmatic_trains = [ all_prussia_trains, all_pragmatic_trains ].flat() +const all_prussia_pragmatic_pieces = [ all_prussia_pieces, all_pragmatic_pieces ].flat() +const all_powers_france_prussia_pragmatic = [ P_FRANCE, P_PRUSSIA, P_PRAGMATIC ] +const all_france_prussia_pragmatic_generals = [ all_france_generals, all_prussia_generals, all_pragmatic_generals ].flat() +const all_france_prussia_pragmatic_trains = [ all_france_trains, all_prussia_trains, all_pragmatic_trains ].flat() +const all_france_prussia_pragmatic_pieces = [ all_france_pieces, all_prussia_pieces, all_pragmatic_pieces ].flat() +const all_powers_austria = [ P_AUSTRIA ] +const all_powers_france_austria = [ P_FRANCE, P_AUSTRIA ] +const all_france_austria_generals = [ all_france_generals, all_austria_generals ].flat() +const all_france_austria_trains = [ all_france_trains, all_austria_trains ].flat() +const all_france_austria_pieces = [ all_france_pieces, all_austria_pieces ].flat() +const all_powers_prussia_austria = [ P_PRUSSIA, P_AUSTRIA ] +const all_prussia_austria_generals = [ all_prussia_generals, all_austria_generals ].flat() +const all_prussia_austria_trains = [ all_prussia_trains, all_austria_trains ].flat() +const all_prussia_austria_pieces = [ all_prussia_pieces, all_austria_pieces ].flat() +const all_powers_france_prussia_austria = [ P_FRANCE, P_PRUSSIA, P_AUSTRIA ] +const all_france_prussia_austria_generals = [ all_france_generals, all_prussia_generals, all_austria_generals ].flat() +const all_france_prussia_austria_trains = [ all_france_trains, all_prussia_trains, all_austria_trains ].flat() +const all_france_prussia_austria_pieces = [ all_france_pieces, all_prussia_pieces, all_austria_pieces ].flat() +const all_powers_pragmatic_austria = [ P_PRAGMATIC, P_AUSTRIA ] +const all_pragmatic_austria_generals = [ all_pragmatic_generals, all_austria_generals ].flat() +const all_pragmatic_austria_trains = [ all_pragmatic_trains, all_austria_trains ].flat() +const all_pragmatic_austria_pieces = [ all_pragmatic_pieces, all_austria_pieces ].flat() +const all_powers_france_pragmatic_austria = [ P_FRANCE, P_PRAGMATIC, P_AUSTRIA ] +const all_france_pragmatic_austria_generals = [ all_france_generals, all_pragmatic_generals, all_austria_generals ].flat() +const all_france_pragmatic_austria_trains = [ all_france_trains, all_pragmatic_trains, all_austria_trains ].flat() +const all_france_pragmatic_austria_pieces = [ all_france_pieces, all_pragmatic_pieces, all_austria_pieces ].flat() +const all_powers_prussia_pragmatic_austria = [ P_PRUSSIA, P_PRAGMATIC, P_AUSTRIA ] +const all_prussia_pragmatic_austria_generals = [ all_prussia_generals, all_pragmatic_generals, all_austria_generals ].flat() +const all_prussia_pragmatic_austria_trains = [ all_prussia_trains, all_pragmatic_trains, all_austria_trains ].flat() +const all_prussia_pragmatic_austria_pieces = [ all_prussia_pieces, all_pragmatic_pieces, all_austria_pieces ].flat() +const all_powers_france_prussia_pragmatic_austria = [ P_FRANCE, P_PRUSSIA, P_PRAGMATIC, P_AUSTRIA ] +const all_france_prussia_pragmatic_austria_generals = [ all_france_generals, all_prussia_generals, all_pragmatic_generals, all_austria_generals ].flat() +const all_france_prussia_pragmatic_austria_trains = [ all_france_trains, all_prussia_trains, all_pragmatic_trains, all_austria_trains ].flat() +const all_france_prussia_pragmatic_austria_pieces = [ all_france_pieces, all_prussia_pieces, all_pragmatic_pieces, all_austria_pieces ].flat() +const all_powers_bavaria = [ P_BAVARIA ] +const all_powers_france_bavaria = [ P_FRANCE, P_BAVARIA ] +const all_france_bavaria_generals = [ all_france_generals, all_bavaria_generals ].flat() +const all_france_bavaria_trains = [ all_france_trains, all_bavaria_trains ].flat() +const all_france_bavaria_pieces = [ all_france_pieces, all_bavaria_pieces ].flat() +const all_powers_prussia_bavaria = [ P_PRUSSIA, P_BAVARIA ] +const all_prussia_bavaria_generals = [ all_prussia_generals, all_bavaria_generals ].flat() +const all_prussia_bavaria_trains = [ all_prussia_trains, all_bavaria_trains ].flat() +const all_prussia_bavaria_pieces = [ all_prussia_pieces, all_bavaria_pieces ].flat() +const all_powers_france_prussia_bavaria = [ P_FRANCE, P_PRUSSIA, P_BAVARIA ] +const all_france_prussia_bavaria_generals = [ all_france_generals, all_prussia_generals, all_bavaria_generals ].flat() +const all_france_prussia_bavaria_trains = [ all_france_trains, all_prussia_trains, all_bavaria_trains ].flat() +const all_france_prussia_bavaria_pieces = [ all_france_pieces, all_prussia_pieces, all_bavaria_pieces ].flat() +const all_powers_pragmatic_bavaria = [ P_PRAGMATIC, P_BAVARIA ] +const all_pragmatic_bavaria_generals = [ all_pragmatic_generals, all_bavaria_generals ].flat() +const all_pragmatic_bavaria_trains = [ all_pragmatic_trains, all_bavaria_trains ].flat() +const all_pragmatic_bavaria_pieces = [ all_pragmatic_pieces, all_bavaria_pieces ].flat() +const all_powers_france_pragmatic_bavaria = [ P_FRANCE, P_PRAGMATIC, P_BAVARIA ] +const all_france_pragmatic_bavaria_generals = [ all_france_generals, all_pragmatic_generals, all_bavaria_generals ].flat() +const all_france_pragmatic_bavaria_trains = [ all_france_trains, all_pragmatic_trains, all_bavaria_trains ].flat() +const all_france_pragmatic_bavaria_pieces = [ all_france_pieces, all_pragmatic_pieces, all_bavaria_pieces ].flat() +const all_powers_prussia_pragmatic_bavaria = [ P_PRUSSIA, P_PRAGMATIC, P_BAVARIA ] +const all_prussia_pragmatic_bavaria_generals = [ all_prussia_generals, all_pragmatic_generals, all_bavaria_generals ].flat() +const all_prussia_pragmatic_bavaria_trains = [ all_prussia_trains, all_pragmatic_trains, all_bavaria_trains ].flat() +const all_prussia_pragmatic_bavaria_pieces = [ all_prussia_pieces, all_pragmatic_pieces, all_bavaria_pieces ].flat() +const all_powers_france_prussia_pragmatic_bavaria = [ P_FRANCE, P_PRUSSIA, P_PRAGMATIC, P_BAVARIA ] +const all_france_prussia_pragmatic_bavaria_generals = [ all_france_generals, all_prussia_generals, all_pragmatic_generals, all_bavaria_generals ].flat() +const all_france_prussia_pragmatic_bavaria_trains = [ all_france_trains, all_prussia_trains, all_pragmatic_trains, all_bavaria_trains ].flat() +const all_france_prussia_pragmatic_bavaria_pieces = [ all_france_pieces, all_prussia_pieces, all_pragmatic_pieces, all_bavaria_pieces ].flat() +const all_powers_austria_bavaria = [ P_AUSTRIA, P_BAVARIA ] +const all_austria_bavaria_generals = [ all_austria_generals, all_bavaria_generals ].flat() +const all_austria_bavaria_trains = [ all_austria_trains, all_bavaria_trains ].flat() +const all_austria_bavaria_pieces = [ all_austria_pieces, all_bavaria_pieces ].flat() +const all_powers_france_austria_bavaria = [ P_FRANCE, P_AUSTRIA, P_BAVARIA ] +const all_france_austria_bavaria_generals = [ all_france_generals, all_austria_generals, all_bavaria_generals ].flat() +const all_france_austria_bavaria_trains = [ all_france_trains, all_austria_trains, all_bavaria_trains ].flat() +const all_france_austria_bavaria_pieces = [ all_france_pieces, all_austria_pieces, all_bavaria_pieces ].flat() +const all_powers_prussia_austria_bavaria = [ P_PRUSSIA, P_AUSTRIA, P_BAVARIA ] +const all_prussia_austria_bavaria_generals = [ all_prussia_generals, all_austria_generals, all_bavaria_generals ].flat() +const all_prussia_austria_bavaria_trains = [ all_prussia_trains, all_austria_trains, all_bavaria_trains ].flat() +const all_prussia_austria_bavaria_pieces = [ all_prussia_pieces, all_austria_pieces, all_bavaria_pieces ].flat() +const all_powers_france_prussia_austria_bavaria = [ P_FRANCE, P_PRUSSIA, P_AUSTRIA, P_BAVARIA ] +const all_france_prussia_austria_bavaria_generals = [ all_france_generals, all_prussia_generals, all_austria_generals, all_bavaria_generals ].flat() +const all_france_prussia_austria_bavaria_trains = [ all_france_trains, all_prussia_trains, all_austria_trains, all_bavaria_trains ].flat() +const all_france_prussia_austria_bavaria_pieces = [ all_france_pieces, all_prussia_pieces, all_austria_pieces, all_bavaria_pieces ].flat() +const all_powers_pragmatic_austria_bavaria = [ P_PRAGMATIC, P_AUSTRIA, P_BAVARIA ] +const all_pragmatic_austria_bavaria_generals = [ all_pragmatic_generals, all_austria_generals, all_bavaria_generals ].flat() +const all_pragmatic_austria_bavaria_trains = [ all_pragmatic_trains, all_austria_trains, all_bavaria_trains ].flat() +const all_pragmatic_austria_bavaria_pieces = [ all_pragmatic_pieces, all_austria_pieces, all_bavaria_pieces ].flat() +const all_powers_france_pragmatic_austria_bavaria = [ P_FRANCE, P_PRAGMATIC, P_AUSTRIA, P_BAVARIA ] +const all_france_pragmatic_austria_bavaria_generals = [ all_france_generals, all_pragmatic_generals, all_austria_generals, all_bavaria_generals ].flat() +const all_france_pragmatic_austria_bavaria_trains = [ all_france_trains, all_pragmatic_trains, all_austria_trains, all_bavaria_trains ].flat() +const all_france_pragmatic_austria_bavaria_pieces = [ all_france_pieces, all_pragmatic_pieces, all_austria_pieces, all_bavaria_pieces ].flat() +const all_powers_prussia_pragmatic_austria_bavaria = [ P_PRUSSIA, P_PRAGMATIC, P_AUSTRIA, P_BAVARIA ] +const all_prussia_pragmatic_austria_bavaria_generals = [ all_prussia_generals, all_pragmatic_generals, all_austria_generals, all_bavaria_generals ].flat() +const all_prussia_pragmatic_austria_bavaria_trains = [ all_prussia_trains, all_pragmatic_trains, all_austria_trains, all_bavaria_trains ].flat() +const all_prussia_pragmatic_austria_bavaria_pieces = [ all_prussia_pieces, all_pragmatic_pieces, all_austria_pieces, all_bavaria_pieces ].flat() +const all_powers_france_prussia_pragmatic_austria_bavaria = [ P_FRANCE, P_PRUSSIA, P_PRAGMATIC, P_AUSTRIA, P_BAVARIA ] +const all_france_prussia_pragmatic_austria_bavaria_generals = [ all_france_generals, all_prussia_generals, all_pragmatic_generals, all_austria_generals, all_bavaria_generals ].flat() +const all_france_prussia_pragmatic_austria_bavaria_trains = [ all_france_trains, all_prussia_trains, all_pragmatic_trains, all_austria_trains, all_bavaria_trains ].flat() +const all_france_prussia_pragmatic_austria_bavaria_pieces = [ all_france_pieces, all_prussia_pieces, all_pragmatic_pieces, all_austria_pieces, all_bavaria_pieces ].flat() +const all_powers_saxony = [ P_SAXONY ] +const all_powers_france_saxony = [ P_FRANCE, P_SAXONY ] +const all_france_saxony_generals = [ all_france_generals, all_saxony_generals ].flat() +const all_france_saxony_trains = [ all_france_trains, all_saxony_trains ].flat() +const all_france_saxony_pieces = [ all_france_pieces, all_saxony_pieces ].flat() +const all_powers_prussia_saxony = [ P_PRUSSIA, P_SAXONY ] +const all_prussia_saxony_generals = [ all_prussia_generals, all_saxony_generals ].flat() +const all_prussia_saxony_trains = [ all_prussia_trains, all_saxony_trains ].flat() +const all_prussia_saxony_pieces = [ all_prussia_pieces, all_saxony_pieces ].flat() +const all_powers_france_prussia_saxony = [ P_FRANCE, P_PRUSSIA, P_SAXONY ] +const all_france_prussia_saxony_generals = [ all_france_generals, all_prussia_generals, all_saxony_generals ].flat() +const all_france_prussia_saxony_trains = [ all_france_trains, all_prussia_trains, all_saxony_trains ].flat() +const all_france_prussia_saxony_pieces = [ all_france_pieces, all_prussia_pieces, all_saxony_pieces ].flat() +const all_powers_pragmatic_saxony = [ P_PRAGMATIC, P_SAXONY ] +const all_pragmatic_saxony_generals = [ all_pragmatic_generals, all_saxony_generals ].flat() +const all_pragmatic_saxony_trains = [ all_pragmatic_trains, all_saxony_trains ].flat() +const all_pragmatic_saxony_pieces = [ all_pragmatic_pieces, all_saxony_pieces ].flat() +const all_powers_france_pragmatic_saxony = [ P_FRANCE, P_PRAGMATIC, P_SAXONY ] +const all_france_pragmatic_saxony_generals = [ all_france_generals, all_pragmatic_generals, all_saxony_generals ].flat() +const all_france_pragmatic_saxony_trains = [ all_france_trains, all_pragmatic_trains, all_saxony_trains ].flat() +const all_france_pragmatic_saxony_pieces = [ all_france_pieces, all_pragmatic_pieces, all_saxony_pieces ].flat() +const all_powers_prussia_pragmatic_saxony = [ P_PRUSSIA, P_PRAGMATIC, P_SAXONY ] +const all_prussia_pragmatic_saxony_generals = [ all_prussia_generals, all_pragmatic_generals, all_saxony_generals ].flat() +const all_prussia_pragmatic_saxony_trains = [ all_prussia_trains, all_pragmatic_trains, all_saxony_trains ].flat() +const all_prussia_pragmatic_saxony_pieces = [ all_prussia_pieces, all_pragmatic_pieces, all_saxony_pieces ].flat() +const all_powers_france_prussia_pragmatic_saxony = [ P_FRANCE, P_PRUSSIA, P_PRAGMATIC, P_SAXONY ] +const all_france_prussia_pragmatic_saxony_generals = [ all_france_generals, all_prussia_generals, all_pragmatic_generals, all_saxony_generals ].flat() +const all_france_prussia_pragmatic_saxony_trains = [ all_france_trains, all_prussia_trains, all_pragmatic_trains, all_saxony_trains ].flat() +const all_france_prussia_pragmatic_saxony_pieces = [ all_france_pieces, all_prussia_pieces, all_pragmatic_pieces, all_saxony_pieces ].flat() +const all_powers_austria_saxony = [ P_AUSTRIA, P_SAXONY ] +const all_austria_saxony_generals = [ all_austria_generals, all_saxony_generals ].flat() +const all_austria_saxony_trains = [ all_austria_trains, all_saxony_trains ].flat() +const all_austria_saxony_pieces = [ all_austria_pieces, all_saxony_pieces ].flat() +const all_powers_france_austria_saxony = [ P_FRANCE, P_AUSTRIA, P_SAXONY ] +const all_france_austria_saxony_generals = [ all_france_generals, all_austria_generals, all_saxony_generals ].flat() +const all_france_austria_saxony_trains = [ all_france_trains, all_austria_trains, all_saxony_trains ].flat() +const all_france_austria_saxony_pieces = [ all_france_pieces, all_austria_pieces, all_saxony_pieces ].flat() +const all_powers_prussia_austria_saxony = [ P_PRUSSIA, P_AUSTRIA, P_SAXONY ] +const all_prussia_austria_saxony_generals = [ all_prussia_generals, all_austria_generals, all_saxony_generals ].flat() +const all_prussia_austria_saxony_trains = [ all_prussia_trains, all_austria_trains, all_saxony_trains ].flat() +const all_prussia_austria_saxony_pieces = [ all_prussia_pieces, all_austria_pieces, all_saxony_pieces ].flat() +const all_powers_france_prussia_austria_saxony = [ P_FRANCE, P_PRUSSIA, P_AUSTRIA, P_SAXONY ] +const all_france_prussia_austria_saxony_generals = [ all_france_generals, all_prussia_generals, all_austria_generals, all_saxony_generals ].flat() +const all_france_prussia_austria_saxony_trains = [ all_france_trains, all_prussia_trains, all_austria_trains, all_saxony_trains ].flat() +const all_france_prussia_austria_saxony_pieces = [ all_france_pieces, all_prussia_pieces, all_austria_pieces, all_saxony_pieces ].flat() +const all_powers_pragmatic_austria_saxony = [ P_PRAGMATIC, P_AUSTRIA, P_SAXONY ] +const all_pragmatic_austria_saxony_generals = [ all_pragmatic_generals, all_austria_generals, all_saxony_generals ].flat() +const all_pragmatic_austria_saxony_trains = [ all_pragmatic_trains, all_austria_trains, all_saxony_trains ].flat() +const all_pragmatic_austria_saxony_pieces = [ all_pragmatic_pieces, all_austria_pieces, all_saxony_pieces ].flat() +const all_powers_france_pragmatic_austria_saxony = [ P_FRANCE, P_PRAGMATIC, P_AUSTRIA, P_SAXONY ] +const all_france_pragmatic_austria_saxony_generals = [ all_france_generals, all_pragmatic_generals, all_austria_generals, all_saxony_generals ].flat() +const all_france_pragmatic_austria_saxony_trains = [ all_france_trains, all_pragmatic_trains, all_austria_trains, all_saxony_trains ].flat() +const all_france_pragmatic_austria_saxony_pieces = [ all_france_pieces, all_pragmatic_pieces, all_austria_pieces, all_saxony_pieces ].flat() +const all_powers_prussia_pragmatic_austria_saxony = [ P_PRUSSIA, P_PRAGMATIC, P_AUSTRIA, P_SAXONY ] +const all_prussia_pragmatic_austria_saxony_generals = [ all_prussia_generals, all_pragmatic_generals, all_austria_generals, all_saxony_generals ].flat() +const all_prussia_pragmatic_austria_saxony_trains = [ all_prussia_trains, all_pragmatic_trains, all_austria_trains, all_saxony_trains ].flat() +const all_prussia_pragmatic_austria_saxony_pieces = [ all_prussia_pieces, all_pragmatic_pieces, all_austria_pieces, all_saxony_pieces ].flat() +const all_powers_france_prussia_pragmatic_austria_saxony = [ P_FRANCE, P_PRUSSIA, P_PRAGMATIC, P_AUSTRIA, P_SAXONY ] +const all_france_prussia_pragmatic_austria_saxony_generals = [ all_france_generals, all_prussia_generals, all_pragmatic_generals, all_austria_generals, all_saxony_generals ].flat() +const all_france_prussia_pragmatic_austria_saxony_trains = [ all_france_trains, all_prussia_trains, all_pragmatic_trains, all_austria_trains, all_saxony_trains ].flat() +const all_france_prussia_pragmatic_austria_saxony_pieces = [ all_france_pieces, all_prussia_pieces, all_pragmatic_pieces, all_austria_pieces, all_saxony_pieces ].flat() +const all_powers_bavaria_saxony = [ P_BAVARIA, P_SAXONY ] +const all_bavaria_saxony_generals = [ all_bavaria_generals, all_saxony_generals ].flat() +const all_bavaria_saxony_trains = [ all_bavaria_trains, all_saxony_trains ].flat() +const all_bavaria_saxony_pieces = [ all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_france_bavaria_saxony = [ P_FRANCE, P_BAVARIA, P_SAXONY ] +const all_france_bavaria_saxony_generals = [ all_france_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_france_bavaria_saxony_trains = [ all_france_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_france_bavaria_saxony_pieces = [ all_france_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_prussia_bavaria_saxony = [ P_PRUSSIA, P_BAVARIA, P_SAXONY ] +const all_prussia_bavaria_saxony_generals = [ all_prussia_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_prussia_bavaria_saxony_trains = [ all_prussia_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_prussia_bavaria_saxony_pieces = [ all_prussia_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_france_prussia_bavaria_saxony = [ P_FRANCE, P_PRUSSIA, P_BAVARIA, P_SAXONY ] +const all_france_prussia_bavaria_saxony_generals = [ all_france_generals, all_prussia_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_france_prussia_bavaria_saxony_trains = [ all_france_trains, all_prussia_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_france_prussia_bavaria_saxony_pieces = [ all_france_pieces, all_prussia_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_pragmatic_bavaria_saxony = [ P_PRAGMATIC, P_BAVARIA, P_SAXONY ] +const all_pragmatic_bavaria_saxony_generals = [ all_pragmatic_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_pragmatic_bavaria_saxony_trains = [ all_pragmatic_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_pragmatic_bavaria_saxony_pieces = [ all_pragmatic_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_france_pragmatic_bavaria_saxony = [ P_FRANCE, P_PRAGMATIC, P_BAVARIA, P_SAXONY ] +const all_france_pragmatic_bavaria_saxony_generals = [ all_france_generals, all_pragmatic_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_france_pragmatic_bavaria_saxony_trains = [ all_france_trains, all_pragmatic_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_france_pragmatic_bavaria_saxony_pieces = [ all_france_pieces, all_pragmatic_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_prussia_pragmatic_bavaria_saxony = [ P_PRUSSIA, P_PRAGMATIC, P_BAVARIA, P_SAXONY ] +const all_prussia_pragmatic_bavaria_saxony_generals = [ all_prussia_generals, all_pragmatic_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_prussia_pragmatic_bavaria_saxony_trains = [ all_prussia_trains, all_pragmatic_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_prussia_pragmatic_bavaria_saxony_pieces = [ all_prussia_pieces, all_pragmatic_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_france_prussia_pragmatic_bavaria_saxony = [ P_FRANCE, P_PRUSSIA, P_PRAGMATIC, P_BAVARIA, P_SAXONY ] +const all_france_prussia_pragmatic_bavaria_saxony_generals = [ all_france_generals, all_prussia_generals, all_pragmatic_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_france_prussia_pragmatic_bavaria_saxony_trains = [ all_france_trains, all_prussia_trains, all_pragmatic_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_france_prussia_pragmatic_bavaria_saxony_pieces = [ all_france_pieces, all_prussia_pieces, all_pragmatic_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_austria_bavaria_saxony = [ P_AUSTRIA, P_BAVARIA, P_SAXONY ] +const all_austria_bavaria_saxony_generals = [ all_austria_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_austria_bavaria_saxony_trains = [ all_austria_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_austria_bavaria_saxony_pieces = [ all_austria_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_france_austria_bavaria_saxony = [ P_FRANCE, P_AUSTRIA, P_BAVARIA, P_SAXONY ] +const all_france_austria_bavaria_saxony_generals = [ all_france_generals, all_austria_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_france_austria_bavaria_saxony_trains = [ all_france_trains, all_austria_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_france_austria_bavaria_saxony_pieces = [ all_france_pieces, all_austria_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_prussia_austria_bavaria_saxony = [ P_PRUSSIA, P_AUSTRIA, P_BAVARIA, P_SAXONY ] +const all_prussia_austria_bavaria_saxony_generals = [ all_prussia_generals, all_austria_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_prussia_austria_bavaria_saxony_trains = [ all_prussia_trains, all_austria_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_prussia_austria_bavaria_saxony_pieces = [ all_prussia_pieces, all_austria_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_france_prussia_austria_bavaria_saxony = [ P_FRANCE, P_PRUSSIA, P_AUSTRIA, P_BAVARIA, P_SAXONY ] +const all_france_prussia_austria_bavaria_saxony_generals = [ all_france_generals, all_prussia_generals, all_austria_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_france_prussia_austria_bavaria_saxony_trains = [ all_france_trains, all_prussia_trains, all_austria_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_france_prussia_austria_bavaria_saxony_pieces = [ all_france_pieces, all_prussia_pieces, all_austria_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_pragmatic_austria_bavaria_saxony = [ P_PRAGMATIC, P_AUSTRIA, P_BAVARIA, P_SAXONY ] +const all_pragmatic_austria_bavaria_saxony_generals = [ all_pragmatic_generals, all_austria_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_pragmatic_austria_bavaria_saxony_trains = [ all_pragmatic_trains, all_austria_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_pragmatic_austria_bavaria_saxony_pieces = [ all_pragmatic_pieces, all_austria_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_france_pragmatic_austria_bavaria_saxony = [ P_FRANCE, P_PRAGMATIC, P_AUSTRIA, P_BAVARIA, P_SAXONY ] +const all_france_pragmatic_austria_bavaria_saxony_generals = [ all_france_generals, all_pragmatic_generals, all_austria_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_france_pragmatic_austria_bavaria_saxony_trains = [ all_france_trains, all_pragmatic_trains, all_austria_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_france_pragmatic_austria_bavaria_saxony_pieces = [ all_france_pieces, all_pragmatic_pieces, all_austria_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() +const all_powers_prussia_pragmatic_austria_bavaria_saxony = [ P_PRUSSIA, P_PRAGMATIC, P_AUSTRIA, P_BAVARIA, P_SAXONY ] +const all_prussia_pragmatic_austria_bavaria_saxony_generals = [ all_prussia_generals, all_pragmatic_generals, all_austria_generals, all_bavaria_generals, all_saxony_generals ].flat() +const all_prussia_pragmatic_austria_bavaria_saxony_trains = [ all_prussia_trains, all_pragmatic_trains, all_austria_trains, all_bavaria_trains, all_saxony_trains ].flat() +const all_prussia_pragmatic_austria_bavaria_saxony_pieces = [ all_prussia_pieces, all_pragmatic_pieces, all_austria_pieces, all_bavaria_pieces, all_saxony_pieces ].flat() + /* DATA */ function is_bohemia_space(s) { @@ -352,101 +603,7 @@ const all_trains = [ ...all_power_trains.flat() ] const all_generals = [ ...all_power_generals.flat() ] const all_generals_by_rank = all_generals.slice().sort((a,b)=>piece_rank[a]-piece_rank[b]) -const all_france_bavaria_generals = [ - ...all_power_generals[P_FRANCE], - ...all_power_generals[P_BAVARIA], -] - -const all_prussia_saxony_generals = [ - ...all_power_generals[P_PRUSSIA], - ...all_power_generals[P_SAXONY], -] - -const all_austria_saxony_generals = [ - ...all_power_generals[P_AUSTRIA], - ...all_power_generals[P_SAXONY], -] - -const all_austria_pragmatic_saxony_trains = [ - ...all_power_trains[P_AUSTRIA], - ...all_power_trains[P_PRAGMATIC], - ...all_power_trains[P_SAXONY], -] - -const all_france_bavaria_trains = [ - ...all_power_trains[P_FRANCE], - ...all_power_trains[P_BAVARIA], -] - -const all_prussia_saxony_trains = [ - ...all_power_trains[P_PRUSSIA], - ...all_power_trains[P_SAXONY], -] - -const all_austria_saxony_trains = [ - ...all_power_trains[P_AUSTRIA], - ...all_power_trains[P_SAXONY], -] - -const all_france_bavaria_prussia_trains = [ - ...all_power_trains[P_FRANCE], - ...all_power_trains[P_BAVARIA], - ...all_power_trains[P_PRUSSIA], -] - -const all_france_bavaria_prussia_saxony_trains = [ - ...all_power_trains[P_FRANCE], - ...all_power_trains[P_BAVARIA], - ...all_power_trains[P_PRUSSIA], - ...all_power_trains[P_SAXONY], -] - -const all_austria_pragmatic_trains = [ - ...all_power_trains[P_AUSTRIA], - ...all_power_trains[P_PRAGMATIC], -] - -const all_austria_pragmatic_generals = [ - ...all_power_generals[P_AUSTRIA], - ...all_power_generals[P_PRAGMATIC], -] - -const all_austria_pragmatic_saxony_generals = [ - ...all_power_generals[P_AUSTRIA], - ...all_power_generals[P_PRAGMATIC], - ...all_power_generals[P_SAXONY], -] - -const all_france_bavaria_prussia_generals = [ - ...all_power_generals[P_FRANCE], - ...all_power_generals[P_BAVARIA], - ...all_power_generals[P_PRUSSIA], -] - -const all_france_bavaria_prussia_saxony_generals = [ - ...all_power_generals[P_FRANCE], - ...all_power_generals[P_BAVARIA], - ...all_power_generals[P_PRUSSIA], - ...all_power_generals[P_SAXONY], -] - const all_powers_none = [] -const all_powers_prussia = [ P_PRUSSIA ] -const all_powers_pragmatic = [ P_PRAGMATIC ] -const all_powers_austria = [ P_AUSTRIA ] -const all_powers_bavaria = [ P_BAVARIA ] -const all_powers_saxony = [ P_SAXONY ] -const all_powers_france_bavaria = [ P_FRANCE, P_BAVARIA ] -const all_powers_prussia_saxony = [ P_PRUSSIA, P_SAXONY ] -const all_powers_austria_saxony = [ P_AUSTRIA, P_SAXONY ] -const all_powers_bavaria_saxony = [ P_BAVARIA, P_SAXONY ] -const all_powers_prussia_saxony_pragmatic_austria = [ P_PRUSSIA, P_SAXONY, P_PRAGMATIC, P_AUSTRIA ] -const all_powers_france_bavaria_pragmatic_austria = [ P_FRANCE, P_BAVARIA, P_PRAGMATIC, P_AUSTRIA ] -const all_powers_france_bavaria_prussia_pragmatic = [ P_FRANCE, P_BAVARIA, P_PRUSSIA, P_PRAGMATIC ] -const all_powers_france_bavaria_prussia = [ P_FRANCE, P_BAVARIA, P_PRUSSIA ] -const all_powers_france_bavaria_prussia_saxony = [ P_FRANCE, P_BAVARIA, P_PRUSSIA, P_SAXONY ] -const all_powers_pragmatic_austria = [ P_PRAGMATIC, P_AUSTRIA ] -const all_powers_pragmatic_austria_saxony = [ P_PRAGMATIC, P_AUSTRIA, P_SAXONY ] function coop_major_power(pow) { if (pow === P_BAVARIA) @@ -486,25 +643,25 @@ function is_hostile_to_austria() { // TODO: simplify all these lists and stuff -function all_controlled_powers(pow) { +function all_controlled_pieces(pow) { switch (coop_major_power(pow)) { case P_FRANCE: - return all_powers_france_bavaria + return all_france_bavaria_pieces case P_PRUSSIA: if (is_saxony_prussian()) - return all_powers_prussia_saxony - return all_powers_prussia + return all_prussia_saxony_pieces + return all_power_pieces[P_PRUSSIA] case P_PRAGMATIC: - return all_powers_pragmatic + return all_power_pieces[P_PRAGMATIC] case P_AUSTRIA: if (is_two_player() && !is_intro()) { if (is_saxony_austrian()) - return all_powers_pragmatic_austria_saxony - return all_powers_pragmatic_austria + return all_pragmatic_austria_saxony_pieces + return all_pragmatic_austria_pieces } if (is_saxony_austrian()) - return all_powers_austria_saxony - return all_powers_austria + return all_austria_saxony_pieces + return all_power_pieces[P_AUSTRIA] } } @@ -521,8 +678,8 @@ function all_controlled_generals(pow) { case P_AUSTRIA: if (is_two_player() && !is_intro()) { if (is_saxony_austrian()) - return all_austria_pragmatic_saxony_generals - return all_austria_pragmatic_generals + return all_pragmatic_austria_saxony_generals + return all_pragmatic_austria_generals } if (is_saxony_austrian()) return all_austria_saxony_generals @@ -543,8 +700,8 @@ function all_controlled_trains(pow) { case P_AUSTRIA: if (is_two_player() && !is_intro()) { if (is_saxony_austrian()) - return all_austria_pragmatic_saxony_trains - return all_austria_pragmatic_trains + return all_pragmatic_austria_saxony_trains + return all_pragmatic_austria_trains } if (is_saxony_austrian()) return all_austria_saxony_trains @@ -583,12 +740,12 @@ function all_enemy_powers(pow) { case P_SAXONY: if (is_saxony_prussian()) return all_powers_pragmatic_austria - return all_powers_france_bavaria_prussia + return all_powers_france_prussia_bavaria case P_PRAGMATIC: case P_AUSTRIA: if (is_saxony_austrian()) - return all_powers_france_bavaria_prussia - return all_powers_france_bavaria_prussia_saxony + return all_powers_france_prussia_bavaria + return all_powers_france_prussia_bavaria_saxony } } @@ -604,18 +761,18 @@ function all_non_coop_powers(pow) { switch (pow) { case P_FRANCE: case P_BAVARIA: - return all_powers_prussia_saxony_pragmatic_austria + return all_powers_prussia_pragmatic_austria_saxony case P_PRUSSIA: - return all_powers_france_bavaria_pragmatic_austria + return all_powers_france_pragmatic_austria_bavaria case P_SAXONY: if (is_saxony_prussian()) - return all_powers_france_bavaria_pragmatic_austria - return all_powers_france_bavaria_prussia_pragmatic + return all_powers_france_pragmatic_austria_bavaria + return all_powers_france_prussia_pragmatic_bavaria case P_PRAGMATIC: case P_AUSTRIA: if (is_saxony_austrian()) - return all_powers_france_bavaria_prussia - return all_powers_france_bavaria_prussia_saxony + return all_powers_france_prussia_bavaria + return all_powers_france_prussia_bavaria_saxony } } @@ -630,33 +787,33 @@ function all_coop_generals(pow) { case P_PRAGMATIC: case P_AUSTRIA: if (is_saxony_austrian()) - return all_austria_pragmatic_saxony_generals - return all_austria_pragmatic_generals + return all_pragmatic_austria_saxony_generals + return all_pragmatic_austria_generals } } function all_france_allied_generals() { if (is_saxony_prussian()) - return all_france_bavaria_prussia_saxony_generals - return all_france_bavaria_prussia_generals + return all_france_prussia_bavaria_saxony_generals + return all_france_prussia_bavaria_generals } function all_france_allied_trains() { if (is_saxony_prussian()) - return all_france_bavaria_prussia_saxony_trains - return all_france_bavaria_prussia_trains + return all_france_prussia_bavaria_saxony_trains + return all_france_prussia_bavaria_trains } function all_austria_allied_generals() { if (is_saxony_austrian()) - return all_austria_pragmatic_saxony_generals - return all_austria_pragmatic_generals + return all_pragmatic_austria_saxony_generals + return all_pragmatic_austria_generals } function all_austria_allied_trains() { if (is_saxony_austrian()) - return all_austria_pragmatic_saxony_trains - return all_austria_pragmatic_trains + return all_pragmatic_austria_saxony_trains + return all_pragmatic_austria_trains } function all_allied_trains(pow) { @@ -1771,7 +1928,7 @@ function search_supply_path(who) { if (who === ARENBERG) { if (set_has(data.country.Netherlands, from)) return 1 - trains = all_austria_pragmatic_trains + trains = all_pragmatic_austria_trains } if (is_home_country(from)) 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()") +} -- cgit v1.2.3