summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-26 22:10:36 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-26 22:14:53 +0200
commit76375e277603bc144ea1c572ec273bd3f3a79dcb (patch)
treeafeed68e1594e28f4d273435a812dd482376093b
parentc2df9cc16c98db5286509e2bf6deef028b111fac (diff)
download1989-dawn-of-freedom-76375e277603bc144ea1c572ec273bd3f3a79dcb.tar.gz
Generate space and card name constants for code.
-rw-r--r--Makefile28
-rw-r--r--play.js418
-rw-r--r--rules.js206
-rw-r--r--tools/gencode.js1
-rw-r--r--tools/genconst.js25
5 files changed, 549 insertions, 129 deletions
diff --git a/Makefile b/Makefile
index daa5c21..fc78fed 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,21 @@
default: rules.js play.js
-rules.js: events.txt
- sed '/const CODE /,$$d' < rules.js > /tmp/rules.js
- node tools/gencode.js >> /tmp/rules.js
- cp /tmp/rules.js rules.js
-play.js: tools/layout.svg
- sed '/var LAYOUT /,$$d' < play.js > /tmp/play.js
- node tools/genlayout.js >> /tmp/play.js
- cp /tmp/play.js play.js
+
+rules.js: events.txt data.js
+ node tools/gencode.js > /tmp/events.inc
+ node tools/genconst.js > /tmp/const.inc
+ sed -i \
+ -e '/BEGIN CONST/,/END CONST/{//!d}' \
+ -e '/BEGIN CONST/r /tmp/const.inc' \
+ -e '/BEGIN EVENTS/,/END EVENTS/{//!d}' \
+ -e '/BEGIN EVENTS/r /tmp/events.inc' \
+ rules.js
+
+play.js: tools/layout.svg data.js
+ node tools/genlayout.js > /tmp/layout.inc
+ node tools/genconst.js > /tmp/const.inc
+ sed -i \
+ -e '/BEGIN CONST/,/END CONST/{//!d}' \
+ -e '/BEGIN CONST/r /tmp/const.inc' \
+ -e '/BEGIN LAYOUT/,/END LAYOUT/{//!d}' \
+ -e '/BEGIN LAYOUT/r /tmp/layout.inc' \
+ play.js
diff --git a/play.js b/play.js
index 03f58f5..f94a7db 100644
--- a/play.js
+++ b/play.js
@@ -1,5 +1,311 @@
"use strict"
+// vim:set foldmethod=marker:
+
+// BEGIN CONST {{{
+
+// SPACES
+const S_SCHWERIN = 0
+const S_ROSTOCK = 1
+const S_BERLIN = 2
+const S_GERMAN_WRITERS = 3
+const S_WALTER_ULBRICHT_ACADEMY = 4
+const S_LUTHERAN_CHURCH = 5
+const S_MAGDEBURG = 6
+const S_HALLE = 7
+const S_LEIPZIG = 8
+const S_ERFURT = 9
+const S_KARL_MARX_STADT = 10
+const S_DRESDEN = 11
+const S_SZCZECIN = 12
+const S_GDANSK = 13
+const S_BYDGOSZCZ = 14
+const S_POZNAN = 15
+const S_WARSZAWA = 16
+const S_BIALYSTOK = 17
+const S_WROCLAW = 18
+const S_CATHOLIC_CHURCH_POLAND = 19
+const S_LODZ = 20
+const S_KATOWICE = 21
+const S_KRAKOW = 22
+const S_LUBLIN = 23
+const S_JAGIELLONIAN_UNIVERSITY = 24
+const S_POLISH_WRITERS = 25
+const S_PLZEN = 26
+const S_CESKE_BUDEJOVICE = 27
+const S_PRAHA = 28
+const S_CHARLES_UNIVERSITY = 29
+const S_CZECH_WRITERS = 30
+const S_BRNO = 31
+const S_OSTRAVA = 32
+const S_BRATISLAVA = 33
+const S_CATHOLIC_CHURCH_CZECHOSLOVAKIA = 34
+const S_PRESOV = 35
+const S_KOSICE = 36
+const S_CATHOLIC_CHURCH_HUNGARY = 37
+const S_GYOR = 38
+const S_TATABANYA = 39
+const S_MISKOLC = 40
+const S_DEBRECEN = 41
+const S_SZOMBATHELY = 42
+const S_SZEKESFEHERVAR = 43
+const S_BUDAPEST = 44
+const S_HUNGARIAN_WRITERS = 45
+const S_EOTVOS_LORAND_UNIVERSITY = 46
+const S_SZEGED = 47
+const S_PECS = 48
+const S_TIMISOARA = 49
+const S_CLUJ_NAPOCA = 50
+const S_TARGU_MURES = 51
+const S_IASI = 52
+const S_BABES_BOLYAI_UNIVERSITY = 53
+const S_ROMANIAN_WRITERS = 54
+const S_HARGHITA_COVASNA = 55
+const S_BRASOV = 56
+const S_ORTHODOX_CHURCH_ROMANIA = 57
+const S_PLOIESTI = 58
+const S_CRAIOVA = 59
+const S_BUCURESTI = 60
+const S_GALATI = 61
+const S_CONSTANTA = 62
+const S_PLEVEN = 63
+const S_ORTHODOX_CHURCH_BULGARIA = 64
+const S_RUSE = 65
+const S_SOFIA_UNIVERSITY = 66
+const S_SOFIA = 67
+const S_STARA_ZAGORA = 68
+const S_RAZGRAD = 69
+const S_BURGAS = 70
+const S_VARNA = 71
+const S_BULGARIAN_WRITERS = 72
+const S_PLOVDIV = 73
+const S_SLIVEN = 74
+
+// CARDS
+const C_LEGACY_OF_MARTIAL_LAW = 1
+const C_SOLIDARITY_LEGALIZED = 2
+const C_WALESA = 3
+const C_MICHNIK = 4
+const C_GENERAL_STRIKE = 5
+const C_BROUGHT_IN_FOR_QUESTIONING = 6
+const C_STATE_RUN_MEDIA = 7
+const C_PRUDENCE = 8
+const C_THE_WALL = 9
+const C_CULT_OF_PERSONALITY = 10
+const C_DISSIDENT_ARRESTED = 11
+const C_APPARATCHIKS = 12
+const C_STASI = 13
+const C_GORBACHEV_CHARMS_THE_WEST = 14
+const C_HONECKER = 15
+const C_NOMENKLATURA = 16
+const C_ROUNDTABLE_TALKS = 17
+const C_POSZGAY_DEFENDS_THE_REVOLUTION = 18
+const C_PAPAL_VISIT = 19
+const C_DEUTSCHE_MARKS = 20
+const C_COMMON_EUROPEAN_HOME = 21
+const C_POWER_STRUGGLE_POLAND = 22
+const C_POWER_STRUGGLE_HUNGARY = 23
+const C_ST_NICHOLAS_CHURCH = 24
+const C_PERESTROIKA = 25
+const C_HELSINKI_FINAL_ACT = 26
+const C_CONSUMERISM = 27
+const C_FACTORY_PARTY_CELLS = 28
+const C_JAN_PALACH_WEEK = 29
+const C_TEAR_GAS = 30
+const C_INTELLIGENTSIA = 31
+const C_PEASANT_PARTIES = 32
+const C_SAJUDIS = 33
+const C_FIDESZ = 34
+const C_HEAL_OUR_BLEEDING_WOUND = 35
+const C_DASH_FOR_THE_WEST = 36
+const C_NAGY_REBURIED = 37
+const C_THE_JULY_CONCEPT = 38
+const C_ECO_GLASNOST = 39
+const C_HUNGARIAN_DEMOCRATIC_FORUM = 40
+const C_CEAUSESCU = 41
+const C_POWER_STRUGGLE_EAST_GERMANY = 42
+const C_POWER_STRUGGLE_BULGARIA = 43
+const C_INFLATIONARY_CURRENCY = 44
+const C_SOVIET_TROOP_WITHDRAWALS = 45
+const C_GOODBYE_LENIN = 46
+const C_BULGARIAN_TURKS_EXPELLED = 47
+const C_WE_ARE_THE_PEOPLE = 48
+const C_FOREIGN_CURRENCY_DEBT_BURDEN = 49
+const C_THE_SINATRA_DOCTRINE = 50
+const C_40TH_ANNIVERSARY_CELEBRATION = 51
+const C_NORMALIZATION = 52
+const C_LI_PENG = 53
+const C_THE_CROWD_TURNS_AGAINST_CEAUSESCU = 54
+const C_POWER_STRUGGLE_CZECHOSLOVAKIA = 55
+const C_FOREIGN_TELEVISION = 56
+const C_CENTRAL_COMMITTEE_RESHUFFLE = 57
+const C_AUSTRIA_HUNGARY_BORDER_REOPENED = 58
+const C_GRENZTRUPPEN = 59
+const C_TOXIC_WASTE = 60
+const C_THE_MONDAY_DEMONSTRATIONS = 61
+const C_YAKOVLEV_COUNSELS_GORBACHEV = 62
+const C_GENSCHER = 63
+const C_LEGACY_OF_1968 = 64
+const C_PRESIDENTIAL_VISIT = 65
+const C_NEW_FORUM = 66
+const C_REFORMER_REHABILITATED = 67
+const C_KLAUS_AND_KOMAREK = 68
+const C_SYSTEMATIZATION = 69
+const C_SECURITATE = 70
+const C_KISS_OF_DEATH = 71
+const C_PEASANT_PARTIES_REVOLT = 72
+const C_LASZLO_TOKES = 73
+const C_FRG_EMBASSIES = 74
+const C_EXIT_VISAS = 75
+const C_WARSAW_PACT_SUMMIT = 76
+const C_SAMIZDAT = 77
+const C_WORKERS_REVOLT = 78
+const C_THE_THIRD_WAY = 79
+const C_NEPOTISM = 80
+const C_THE_BALTIC_WAY = 81
+const C_SPITZEL = 82
+const C_MODROW = 83
+const C_BREAKAWAY_BALTIC_REPUBLICS = 84
+const C_TANK_COLUMN_TANK_MAN = 85
+const C_THE_WALL_MUST_GO = 86
+const C_KOHL_PROPOSES_REUNIFICATION = 87
+const C_ADAMEC = 88
+const C_DOMINO_THEORY = 89
+const C_CIVIC_FORUM = 90
+const C_MY_FIRST_BANANA = 91
+const C_BETRAYAL = 92
+const C_SHOCK_THERAPY = 93
+const C_UNION_OF_DEMOCRATIC_FORCES = 94
+const C_POWER_STRUGGLE_ROMANIA = 95
+const C_THE_CHINESE_SOLUTION = 96
+const C_THE_TYRANT_IS_GONE = 97
+const C_POLITBURO_INTRIGUE = 98
+const C_LIGACHEV = 99
+const C_STAND_FAST = 100
+const C_ELENA = 101
+const C_NATIONAL_SALVATION_FRONT = 102
+const C_GOVERNMENT_RESIGNS = 103
+const C_NEW_YEARS_EVE_PARTY = 104
+const C_PUBLIC_AGAINST_VIOLENCE = 105
+const C_SOCIAL_DEMOCRATIC_PLATFORM_ADOPTED = 106
+const C_MASSACRE_IN_TIMISOARA = 107
+const C_ARMY_BACKS_REVOLUTION = 108
+const C_KREMLIN_COUP = 109
+const C_MALTA_SUMMIT = 110
+
+// END CONST }}}
+// BEGIN LAYOUT {{{
+var LAYOUT = {
+ "Babes-Bolyai University": [958,1529,127,75],
+ "Berlin": [329,148,127,75],
+ "Bialystok": [1202,436,127,76],
+ "Brasov": [1339,1556,127,75],
+ "Bratislava": [539,1013,127,76],
+ "Brno": [521,904,127,76],
+ "Bucuresti": [1186,1837,127,76],
+ "Budapest": [809,1249,127,76],
+ "Bulgarian Writers": [838,2192,127,76],
+ "Burgas": [1289,2152,127,76],
+ "Bydgoszcz": [872,388,127,76],
+ "Catholic Church, Czechoslovakia": [692,1010,127,75],
+ "Catholic Church, Hungary": [409,1126,127,76],
+ "Catholic Church, Poland": [802,558,127,75],
+ "Ceske Budejovice": [260,765,127,77],
+ "Charles University": [491,677,128,76],
+ "Cluj-Napoca": [970,1429,127,76],
+ "Constanta": [1443,1925,127,76],
+ "Craiova": [977,1793,127,76],
+ "Czech Writers": [573,773,127,76],
+ "Debrecen": [1000,1192,127,76],
+ "Dresden": [343,479,127,76],
+ "Eotvos Lorand University": [658,1314,127,76],
+ "Erfurt": [38,455,127,76],
+ "Galati": [1409,1778,127,76],
+ "Gdansk": [896,277,127,76],
+ "German Writers": [81,239,127,76],
+ "Gyor": [560,1129,127,76],
+ "Halle": [231,357,127,75],
+ "Harghita/Covasna": [1186,1560,127,75],
+ "Hungarian Writers": [452,1322,127,76],
+ "Iasi": [1369,1395,127,76],
+ "Jagiellonian University": [870,867,127,76],
+ "Karl-Marx-Stadt": [184,492,127,75],
+ "Katowice": [733,723,127,76],
+ "Kosice": [995,1037,127,76],
+ "Krakow": [911,761,127,76],
+ "Leipzig": [387,379,127,76],
+ "Lodz": [959,620,127,76],
+ "Lublin": [1124,754,127,76],
+ "Lutheran Church": [391,271,127,76],
+ "Magdeburg": [79,352,127,75],
+ "Miskolc": [851,1146,127,76],
+ "Orthodox Church, Bulgaria": [1130,1956,127,76],
+ "Orthodox Church, Romania": [1094,1700,127,76],
+ "Ostrava": [673,868,127,75],
+ "Pecs": [626,1406,127,75],
+ "Pleven": [979,1948,127,76],
+ "Ploiesti": [1356,1671,127,76],
+ "Plovdiv": [987,2209,127,75],
+ "Plzen": [211,615,127,76],
+ "Polish Writers": [1051,883,127,75],
+ "Poznan": [671,452,127,76],
+ "Praha": [412,782,127,75],
+ "Presov": [844,1010,127,75],
+ "Razgrad": [1219,2057,127,76],
+ "Romanian Writers": [947,1625,127,75],
+ "Rostock": [299,53,127,76],
+ "Ruse": [1277,1956,127,76],
+ "Schwerin": [148,86,127,76],
+ "Sliven": [1144,2251,127,75],
+ "Sofia": [983,2098,127,76],
+ "Sofia University": [828,2095,127,76],
+ "Stara Zagora": [1133,2153,127,75],
+ "Szczecin": [574,263,127,75],
+ "Szeged": [812,1364,127,76],
+ "Szekesfehervar": [571,1223,127,75],
+ "Szombathely": [410,1224,127,76],
+ "Targu Mures": [1169,1443,127,76],
+ "Tatabanya": [706,1126,127,75],
+ "Timisoara": [767,1531,127,76],
+ "Varna": [1387,2051,127,76],
+ "Walter Ulbricht Academy": [234,240,127,76],
+ "Warszawa": [1032,490,127,75],
+ "Wroclaw": [595,565,127,75],
+ "action_1": [708,143,48,44],
+ "action_8": [1080,143,47,43],
+ "country_bulgaria": [915,1999,46,41],
+ "country_czechoslovakia": [463,624,44,39],
+ "country_east_germany": [560,160,43,37],
+ "country_hungary": [1034,1319,44,39],
+ "country_poland": [1188,292,44,39],
+ "country_romania": [1287,1349,44,39],
+ "event_solidarity_legalized": [779,270,44,43],
+ "event_the_wall": [222,179,40,41],
+ "tst_com_1": [53,2257,47,47],
+ "tst_com_7": [469,2257,47,47],
+ "tst_com_8": [556,2257,47,47],
+ "tst_dem_1": [53,2128,47,47],
+ "tst_dem_7": [469,2128,47,47],
+ "tst_dem_8": [556,2128,47,47],
+ "turn_1": [655,81,47,48],
+ "turn_10": [1133,80,48,48],
+ "ussr_1": [1381,1080,48,48],
+ "ussr_2": [1381,1134,48,48],
+ "ussr_3": [1381,1188,48,48],
+ "ussr_4": [1381,1243,48,48],
+ "ussr_5": [1381,1297,48,48],
+ "vp_0": [843,2425,55,51],
+ "vp_1": [883,2395,55,50],
+ "vp_19": [1440,2395,55,50],
+ "vp_2": [913,2455,56,51],
+ "vp_20": [1471,2455,55,51],
+ "vp_neg_1": [803,2455,56,51],
+ "vp_neg_19": [246,2456,55,50],
+ "vp_neg_2": [772,2395,56,51],
+ "vp_neg_20": [215,2395,55,51],
+}
+// END LAYOUT }}}
+
let action_register = []
function register_action(target, action, id) {
@@ -544,115 +850,3 @@ function toggle_removed() {
function find_country_index(country) {
return countries.indexOf(country)
}
-
-// #region GENERATED LAYOUT DATA
-
-var LAYOUT = {
- "Babes-Bolyai University": [958,1529,127,75],
- "Berlin": [329,148,127,75],
- "Bialystok": [1202,436,127,76],
- "Brasov": [1339,1556,127,75],
- "Bratislava": [539,1013,127,76],
- "Brno": [521,904,127,76],
- "Bucuresti": [1186,1837,127,76],
- "Budapest": [809,1249,127,76],
- "Bulgarian Writers": [838,2192,127,76],
- "Burgas": [1289,2152,127,76],
- "Bydgoszcz": [872,388,127,76],
- "Catholic Church, Czechoslovakia": [692,1010,127,75],
- "Catholic Church, Hungary": [409,1126,127,76],
- "Catholic Church, Poland": [802,558,127,75],
- "Ceske Budejovice": [260,765,127,77],
- "Charles University": [491,677,128,76],
- "Cluj-Napoca": [970,1429,127,76],
- "Constanta": [1443,1925,127,76],
- "Craiova": [977,1793,127,76],
- "Czech Writers": [573,773,127,76],
- "Debrecen": [1000,1192,127,76],
- "Dresden": [343,479,127,76],
- "Eotvos Lorand University": [658,1314,127,76],
- "Erfurt": [38,455,127,76],
- "Galati": [1409,1778,127,76],
- "Gdansk": [896,277,127,76],
- "German Writers": [81,239,127,76],
- "Gyor": [560,1129,127,76],
- "Halle": [231,357,127,75],
- "Harghita/Covasna": [1186,1560,127,75],
- "Hungarian Writers": [452,1322,127,76],
- "Iasi": [1369,1395,127,76],
- "Jagiellonian University": [870,867,127,76],
- "Karl-Marx-Stadt": [184,492,127,75],
- "Katowice": [733,723,127,76],
- "Kosice": [995,1037,127,76],
- "Krakow": [911,761,127,76],
- "Leipzig": [387,379,127,76],
- "Lodz": [959,620,127,76],
- "Lublin": [1124,754,127,76],
- "Lutheran Church": [391,271,127,76],
- "Magdeburg": [79,352,127,75],
- "Miskolc": [851,1146,127,76],
- "Orthodox Church, Bulgaria": [1130,1956,127,76],
- "Orthodox Church, Romania": [1094,1700,127,76],
- "Ostrava": [673,868,127,75],
- "Pecs": [626,1406,127,75],
- "Pleven": [979,1948,127,76],
- "Ploiesti": [1356,1671,127,76],
- "Plovdiv": [987,2209,127,75],
- "Plzen": [211,615,127,76],
- "Polish Writers": [1051,883,127,75],
- "Poznan": [671,452,127,76],
- "Praha": [412,782,127,75],
- "Presov": [844,1010,127,75],
- "Razgrad": [1219,2057,127,76],
- "Romanian Writers": [947,1625,127,75],
- "Rostock": [299,53,127,76],
- "Ruse": [1277,1956,127,76],
- "Schwerin": [148,86,127,76],
- "Sliven": [1144,2251,127,75],
- "Sofia": [983,2098,127,76],
- "Sofia University": [828,2095,127,76],
- "Stara Zagora": [1133,2153,127,75],
- "Szczecin": [574,263,127,75],
- "Szeged": [812,1364,127,76],
- "Szekesfehervar": [571,1223,127,75],
- "Szombathely": [410,1224,127,76],
- "Targu Mures": [1169,1443,127,76],
- "Tatabanya": [706,1126,127,75],
- "Timisoara": [767,1531,127,76],
- "Varna": [1387,2051,127,76],
- "Walter Ulbricht Academy": [234,240,127,76],
- "Warszawa": [1032,490,127,75],
- "Wroclaw": [595,565,127,75],
- "action_1": [708,143,48,44],
- "action_8": [1080,143,47,43],
- "country_bulgaria": [915,1999,46,41],
- "country_czechoslovakia": [463,624,44,39],
- "country_east_germany": [560,160,43,37],
- "country_hungary": [1034,1319,44,39],
- "country_poland": [1188,292,44,39],
- "country_romania": [1287,1349,44,39],
- "event_solidarity_legalized": [779,270,44,43],
- "event_the_wall": [222,179,40,41],
- "tst_com_1": [53,2257,47,47],
- "tst_com_7": [469,2257,47,47],
- "tst_com_8": [556,2257,47,47],
- "tst_dem_1": [53,2128,47,47],
- "tst_dem_7": [469,2128,47,47],
- "tst_dem_8": [556,2128,47,47],
- "turn_1": [655,81,47,48],
- "turn_10": [1133,80,48,48],
- "ussr_1": [1381,1080,48,48],
- "ussr_2": [1381,1134,48,48],
- "ussr_3": [1381,1188,48,48],
- "ussr_4": [1381,1243,48,48],
- "ussr_5": [1381,1297,48,48],
- "vp_0": [843,2425,55,51],
- "vp_1": [883,2395,55,50],
- "vp_19": [1440,2395,55,50],
- "vp_2": [913,2455,56,51],
- "vp_20": [1471,2455,55,51],
- "vp_neg_1": [803,2455,56,51],
- "vp_neg_19": [246,2456,55,50],
- "vp_neg_2": [772,2395,56,51],
- "vp_neg_20": [215,2395,55,51],
-} \ No newline at end of file
diff --git a/rules.js b/rules.js
index bebde72..a65383e 100644
--- a/rules.js
+++ b/rules.js
@@ -1,4 +1,6 @@
-//"use strict"
+"use strict"
+
+// vim:set foldmethod=marker:
const { spaces, cards, power_cards } = require("./data.js")
@@ -10,6 +12,199 @@ const COM = "Communist"
const first_strategy_card = 1
const last_strategy_card = 110
+// BEGIN CONSTANTS {{{
+
+// SPACES
+const S_SCHWERIN = 0
+const S_ROSTOCK = 1
+const S_BERLIN = 2
+const S_GERMAN_WRITERS = 3
+const S_WALTER_ULBRICHT_ACADEMY = 4
+const S_LUTHERAN_CHURCH = 5
+const S_MAGDEBURG = 6
+const S_HALLE = 7
+const S_LEIPZIG = 8
+const S_ERFURT = 9
+const S_KARL_MARX_STADT = 10
+const S_DRESDEN = 11
+const S_SZCZECIN = 12
+const S_GDANSK = 13
+const S_BYDGOSZCZ = 14
+const S_POZNAN = 15
+const S_WARSZAWA = 16
+const S_BIALYSTOK = 17
+const S_WROCLAW = 18
+const S_CATHOLIC_CHURCH_POLAND = 19
+const S_LODZ = 20
+const S_KATOWICE = 21
+const S_KRAKOW = 22
+const S_LUBLIN = 23
+const S_JAGIELLONIAN_UNIVERSITY = 24
+const S_POLISH_WRITERS = 25
+const S_PLZEN = 26
+const S_CESKE_BUDEJOVICE = 27
+const S_PRAHA = 28
+const S_CHARLES_UNIVERSITY = 29
+const S_CZECH_WRITERS = 30
+const S_BRNO = 31
+const S_OSTRAVA = 32
+const S_BRATISLAVA = 33
+const S_CATHOLIC_CHURCH_CZECHOSLOVAKIA = 34
+const S_PRESOV = 35
+const S_KOSICE = 36
+const S_CATHOLIC_CHURCH_HUNGARY = 37
+const S_GYOR = 38
+const S_TATABANYA = 39
+const S_MISKOLC = 40
+const S_DEBRECEN = 41
+const S_SZOMBATHELY = 42
+const S_SZEKESFEHERVAR = 43
+const S_BUDAPEST = 44
+const S_HUNGARIAN_WRITERS = 45
+const S_EOTVOS_LORAND_UNIVERSITY = 46
+const S_SZEGED = 47
+const S_PECS = 48
+const S_TIMISOARA = 49
+const S_CLUJ_NAPOCA = 50
+const S_TARGU_MURES = 51
+const S_IASI = 52
+const S_BABES_BOLYAI_UNIVERSITY = 53
+const S_ROMANIAN_WRITERS = 54
+const S_HARGHITA_COVASNA = 55
+const S_BRASOV = 56
+const S_ORTHODOX_CHURCH_ROMANIA = 57
+const S_PLOIESTI = 58
+const S_CRAIOVA = 59
+const S_BUCURESTI = 60
+const S_GALATI = 61
+const S_CONSTANTA = 62
+const S_PLEVEN = 63
+const S_ORTHODOX_CHURCH_BULGARIA = 64
+const S_RUSE = 65
+const S_SOFIA_UNIVERSITY = 66
+const S_SOFIA = 67
+const S_STARA_ZAGORA = 68
+const S_RAZGRAD = 69
+const S_BURGAS = 70
+const S_VARNA = 71
+const S_BULGARIAN_WRITERS = 72
+const S_PLOVDIV = 73
+const S_SLIVEN = 74
+
+// CARDS
+const C_LEGACY_OF_MARTIAL_LAW = 1
+const C_SOLIDARITY_LEGALIZED = 2
+const C_WALESA = 3
+const C_MICHNIK = 4
+const C_GENERAL_STRIKE = 5
+const C_BROUGHT_IN_FOR_QUESTIONING = 6
+const C_STATE_RUN_MEDIA = 7
+const C_PRUDENCE = 8
+const C_THE_WALL = 9
+const C_CULT_OF_PERSONALITY = 10
+const C_DISSIDENT_ARRESTED = 11
+const C_APPARATCHIKS = 12
+const C_STASI = 13
+const C_GORBACHEV_CHARMS_THE_WEST = 14
+const C_HONECKER = 15
+const C_NOMENKLATURA = 16
+const C_ROUNDTABLE_TALKS = 17
+const C_POSZGAY_DEFENDS_THE_REVOLUTION = 18
+const C_PAPAL_VISIT = 19
+const C_DEUTSCHE_MARKS = 20
+const C_COMMON_EUROPEAN_HOME = 21
+const C_POWER_STRUGGLE_POLAND = 22
+const C_POWER_STRUGGLE_HUNGARY = 23
+const C_ST_NICHOLAS_CHURCH = 24
+const C_PERESTROIKA = 25
+const C_HELSINKI_FINAL_ACT = 26
+const C_CONSUMERISM = 27
+const C_FACTORY_PARTY_CELLS = 28
+const C_JAN_PALACH_WEEK = 29
+const C_TEAR_GAS = 30
+const C_INTELLIGENTSIA = 31
+const C_PEASANT_PARTIES = 32
+const C_SAJUDIS = 33
+const C_FIDESZ = 34
+const C_HEAL_OUR_BLEEDING_WOUND = 35
+const C_DASH_FOR_THE_WEST = 36
+const C_NAGY_REBURIED = 37
+const C_THE_JULY_CONCEPT = 38
+const C_ECO_GLASNOST = 39
+const C_HUNGARIAN_DEMOCRATIC_FORUM = 40
+const C_CEAUSESCU = 41
+const C_POWER_STRUGGLE_EAST_GERMANY = 42
+const C_POWER_STRUGGLE_BULGARIA = 43
+const C_INFLATIONARY_CURRENCY = 44
+const C_SOVIET_TROOP_WITHDRAWALS = 45
+const C_GOODBYE_LENIN = 46
+const C_BULGARIAN_TURKS_EXPELLED = 47
+const C_WE_ARE_THE_PEOPLE = 48
+const C_FOREIGN_CURRENCY_DEBT_BURDEN = 49
+const C_THE_SINATRA_DOCTRINE = 50
+const C_40TH_ANNIVERSARY_CELEBRATION = 51
+const C_NORMALIZATION = 52
+const C_LI_PENG = 53
+const C_THE_CROWD_TURNS_AGAINST_CEAUSESCU = 54
+const C_POWER_STRUGGLE_CZECHOSLOVAKIA = 55
+const C_FOREIGN_TELEVISION = 56
+const C_CENTRAL_COMMITTEE_RESHUFFLE = 57
+const C_AUSTRIA_HUNGARY_BORDER_REOPENED = 58
+const C_GRENZTRUPPEN = 59
+const C_TOXIC_WASTE = 60
+const C_THE_MONDAY_DEMONSTRATIONS = 61
+const C_YAKOVLEV_COUNSELS_GORBACHEV = 62
+const C_GENSCHER = 63
+const C_LEGACY_OF_1968 = 64
+const C_PRESIDENTIAL_VISIT = 65
+const C_NEW_FORUM = 66
+const C_REFORMER_REHABILITATED = 67
+const C_KLAUS_AND_KOMAREK = 68
+const C_SYSTEMATIZATION = 69
+const C_SECURITATE = 70
+const C_KISS_OF_DEATH = 71
+const C_PEASANT_PARTIES_REVOLT = 72
+const C_LASZLO_TOKES = 73
+const C_FRG_EMBASSIES = 74
+const C_EXIT_VISAS = 75
+const C_WARSAW_PACT_SUMMIT = 76
+const C_SAMIZDAT = 77
+const C_WORKERS_REVOLT = 78
+const C_THE_THIRD_WAY = 79
+const C_NEPOTISM = 80
+const C_THE_BALTIC_WAY = 81
+const C_SPITZEL = 82
+const C_MODROW = 83
+const C_BREAKAWAY_BALTIC_REPUBLICS = 84
+const C_TANK_COLUMN_TANK_MAN = 85
+const C_THE_WALL_MUST_GO = 86
+const C_KOHL_PROPOSES_REUNIFICATION = 87
+const C_ADAMEC = 88
+const C_DOMINO_THEORY = 89
+const C_CIVIC_FORUM = 90
+const C_MY_FIRST_BANANA = 91
+const C_BETRAYAL = 92
+const C_SHOCK_THERAPY = 93
+const C_UNION_OF_DEMOCRATIC_FORCES = 94
+const C_POWER_STRUGGLE_ROMANIA = 95
+const C_THE_CHINESE_SOLUTION = 96
+const C_THE_TYRANT_IS_GONE = 97
+const C_POLITBURO_INTRIGUE = 98
+const C_LIGACHEV = 99
+const C_STAND_FAST = 100
+const C_ELENA = 101
+const C_NATIONAL_SALVATION_FRONT = 102
+const C_GOVERNMENT_RESIGNS = 103
+const C_NEW_YEARS_EVE_PARTY = 104
+const C_PUBLIC_AGAINST_VIOLENCE = 105
+const C_SOCIAL_DEMOCRATIC_PLATFORM_ADOPTED = 106
+const C_MASSACRE_IN_TIMISOARA = 107
+const C_ARMY_BACKS_REVOLUTION = 108
+const C_KREMLIN_COUP = 109
+const C_MALTA_SUMMIT = 110
+
+// END CONSTANTS }}}
+
const dem_tst_req = [5, 5, 6, 6, 7, 8, 9, 10]
const com_tst_req = [6, 6, 7, 7, 8, 7, 6, 5]
const scoring_cards = [22, 23, 42, 43, 55, 95]
@@ -9038,7 +9233,7 @@ states.vm_support_falters = {
/* =================== EVENTS ================================ */
-// #region GENERATED EVENT CODE
+// BEGIN EVENTS {{{
const CODE = []
CODE[1] = [ // Legacy of Martial Law*
@@ -9941,9 +10136,4 @@ CODE[351] = [ // Scare Tactics
[ vm_remove_opp_infl, 1 ],
[ vm_return ],
]
-
-
-
-
-// #endregion
-
+// END EVENTS }}}
diff --git a/tools/gencode.js b/tools/gencode.js
index f2e3a26..a46823f 100644
--- a/tools/gencode.js
+++ b/tools/gencode.js
@@ -103,4 +103,3 @@ for (let line of fs.readFileSync("events.txt", "utf-8").split("\n")) {
emit(["return"])
console.log("]")
-console.log("// #endregion")
diff --git a/tools/genconst.js b/tools/genconst.js
new file mode 100644
index 0000000..a2b9235
--- /dev/null
+++ b/tools/genconst.js
@@ -0,0 +1,25 @@
+const data = require("../data.js")
+
+function clean_name(s) {
+ return s.toUpperCase()
+ .replace(" - ", "_")
+ .replace(/[ /-]/g, "_")
+ .replace(/[!,*"'.]/g, "")
+}
+
+console.log("")
+
+console.log("// SPACES")
+for (let s of data.spaces) {
+ console.log("const S_" + clean_name(s.ascii_name) + " = " + s.space_id)
+}
+
+console.log("")
+
+console.log("// CARDS")
+for (let c of data.cards) {
+ if (c)
+ console.log("const C_" + clean_name(c.name) + " = " + c.number)
+}
+
+console.log("")