diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-27 08:02:11 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-27 08:02:11 +0000 |
commit | 18bb386d69a86df0d20e685fabdee873c7d10979 (patch) | |
tree | 161289606af608d6e9ea2b402bb7d0e387f428c1 | |
parent | 129fca876d1efb7b238e277fc82c6589d52ac016 (diff) | |
parent | b8a0e71403e00cdce59f86c576cdfc68a76b7f10 (diff) | |
download | 1989-dawn-of-freedom-18bb386d69a86df0d20e685fabdee873c7d10979.tar.gz |
Merge branch 'work-in-progress' of https://github.com/iainp5/1989-Dawn-of-Freedom into work-in-progress
Tor updates for constants
-rw-r--r-- | .editorconfig | 7 | ||||
-rw-r--r-- | Makefile | 28 | ||||
-rw-r--r-- | favicon.png | bin | 10723 -> 0 bytes | |||
-rw-r--r-- | images/Hammer_and_sickle.svg | 5 | ||||
-rw-r--r-- | images/favicon_com.svg | 5 | ||||
-rw-r--r-- | images/favicon_dem.svg | 39 | ||||
-rw-r--r-- | play.html | 2 | ||||
-rw-r--r-- | play.js | 635 | ||||
-rw-r--r-- | rules.js | 206 | ||||
-rw-r--r-- | tools/gencode.js | 1 | ||||
-rw-r--r-- | tools/genconst.js | 25 |
11 files changed, 713 insertions, 240 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5f2605e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*.js] +indent_style = tab +insert_final_newline = true +trim_trailing_whitespace = true +end_of_line = lf @@ -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/favicon.png b/favicon.png Binary files differdeleted file mode 100644 index 7431f53..0000000 --- a/favicon.png +++ /dev/null diff --git a/images/Hammer_and_sickle.svg b/images/Hammer_and_sickle.svg new file mode 100644 index 0000000..4aa6dd0 --- /dev/null +++ b/images/Hammer_and_sickle.svg @@ -0,0 +1,5 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600"> +<path fill="#c00" d="M0 0h600v600H0z"/> +<path fill="gold" d="m157.543 922.363-16.971 16.971-45.256 45.254-56.571 56.57 62.227 62.225 56.571-56.568 299.828 299.812a32 32 0 0 0 45.256 0 32 32 0 0 0 0-45.254l-299.826-299.814 16.971-16.971 50.915-50.91z" transform="translate(43 -799)"/> +<path fill="gold" d="M255.989 844s168.008 128 168.008 256c0 64-56.003 136-152.007 136-64.003 0-104.241-47.764-104.241-47.764l-11.313 11.313a16 16 0 0 0-22.628 0 16 16 0 0 0-2.48 3.223 32 32 0 0 0-31.463 8.091 32 32 0 0 0-9.331 21.545c-25.432 13.753-67.565 40.575-86.27 75.592l.03.029a32 32 0 0 0-.03 31.971 32 32 0 0 0 43.715 11.713c35.026-18.708 61.855-60.852 75.605-86.281a32 32 0 0 0 21.537-9.315 32 32 0 0 0 7.932-13.201C177.569 1265.97 224.497 1300 287.99 1300c96.005 0 200.01-72 200.01-200 0-160-232.011-256-232.011-256" transform="translate(43 -799)"/> +</svg> diff --git a/images/favicon_com.svg b/images/favicon_com.svg new file mode 100644 index 0000000..9f9cc3b --- /dev/null +++ b/images/favicon_com.svg @@ -0,0 +1,5 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="56.693" height="56.693"> +<path fill="#bf2329" stroke-width="1.33333" d="M56.693 49.135c0 4.157-3.402 7.558-7.558 7.558H7.559C3.403 56.693 0 53.292 0 49.135V7.56C0 3.403 3.403 0 7.559 0h41.576c4.156 0 7.558 3.403 7.558 7.56z"/> +<path fill="#f14d3e" stroke-width="1.33333" d="m15.776 26.877-4.195-4.024 9.55-9.549 6.896 1.273-5.411 5.518S48.01 44.104 49.07 45.27s.069 2.412-.462 3.046c-.53.639-1.921 1.454-2.993.394-1.143-1.126-25.419-26.14-25.419-26.14Z"/> +<path fill="#f14d3e" stroke-width="1.33333" d="M15.765 35.833s10.248 5.45 16.268 4.802c6.02-.65 11.714-3.5 11.47-14.482-.244-10.978-15.538-20.7-15.538-20.7s21.07 5.328 21.556 22.043c.408 13.96-8.052 19.199-16.592 18.792S16.496 38.76 16.496 38.76l-.65.57.023.046s.642 1.343.114 1.95c-1.006 1.16-1.939-.067-2.46.474-.52.538-1.572 4.027-3.17 5.596-1.596 1.567-3.029 2.192-4.104 1.655l-.424-.339c-.666-1-.221-2.5 1.138-4.276 1.361-1.777 4.693-3.25 5.164-3.833s-.86-1.36.166-2.497c.542-.598 1.951-.128 1.951-.128z"/> +</svg> diff --git a/images/favicon_dem.svg b/images/favicon_dem.svg new file mode 100644 index 0000000..d91fcc7 --- /dev/null +++ b/images/favicon_dem.svg @@ -0,0 +1,39 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="56.693" height="56.693"> +<path fill="#397dc6" stroke-width="1.33333" d="M56.693 49.135c0 4.157-3.401 7.558-7.56 7.558H7.56c-4.159 0-7.56-3.401-7.56-7.558V7.56C0 3.403 3.401 0 7.56 0h41.573c4.159 0 7.56 3.403 7.56 7.56z"/> +<path fill="#c9e7f6" d="M12.596 23.901c1.639 1.472 2.416 3.67 3.388 5.69.445.925 1.07 1.758 1.413 2.669-2.305.21-2.298 2.644-2.6 4.485-.36 2.218-2.225 3.042-2.906 4.956-.65 1.82 1.081 4.32 1.778 6.002.891 2.136 1.495 3.628 3.011 5.28a105 105 0 0 0 2.621 2.732c.267.269 22.207.226 22.088-.06-1.252-3.046-1.738-6.672-2.432-9.847-.445-2.043-1.148-4.388-2.261-6.273-1.168-1.98-2.559-3.516-3.364-5.728-1.484-4.078-2.361-8.171-2.93-12.38-.285-2.111-.091-4.215-.514-6.304-.415-2.051-.717-4.036-1.024-6.127-.148-1.019-.599-2.116-.844-3.11-.252-1.029-.244-2.2-.763-3.162-.966-1.796-3.573-1.921-4.641-.18-1.115 1.816-.088 4.136.141 6.02.256 2.103.69 4.113.714 6.277.02 1.902-.115 4.058.094 5.927.162 1.419 1.703 6.29-.33 7.019-1.944.696-4.043-5.71-5.12-6.88-1.446-1.576-2.592-3.17-3.896-4.872-.659-.86-1.704-1.495-2.375-2.374-.636-.833-1.057-1.742-1.69-2.556-1.19-1.526-2.586-3.532-4.771-2.912-3.268.93-1.066 3.027-.068 4.627 1.21 1.936 2.172 4.095 3.24 6.1 1.189 2.241 2.172 3.303 4.041 4.981"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M12.596 23.901c1.639 1.472 2.416 3.67 3.388 5.69.445.925 1.07 1.758 1.413 2.669-2.305.21-2.298 2.644-2.6 4.485-.36 2.218-2.225 3.042-2.906 4.956-.65 1.82 1.081 4.32 1.778 6.002.891 2.136 1.495 3.628 3.011 5.28a105 105 0 0 0 2.621 2.732c.267.269 22.207.226 22.088-.06-1.252-3.046-1.738-6.672-2.432-9.847-.445-2.043-1.148-4.388-2.261-6.273-1.168-1.98-2.559-3.516-3.364-5.728-1.484-4.078-2.361-8.171-2.93-12.38-.285-2.111-.091-4.215-.514-6.304-.415-2.051-.717-4.036-1.024-6.127-.148-1.019-.599-2.116-.844-3.11-.252-1.029-.244-2.2-.763-3.162-.966-1.796-3.573-1.921-4.641-.18-1.115 1.816-.088 4.136.141 6.02.256 2.103.69 4.113.714 6.277.02 1.902-.115 4.058.094 5.927.162 1.419 1.703 6.29-.33 7.019-1.944.696-4.043-5.71-5.12-6.88-1.446-1.576-2.592-3.17-3.896-4.872-.659-.86-1.704-1.495-2.375-2.374-.636-.833-1.057-1.742-1.69-2.556-1.19-1.526-2.586-3.532-4.771-2.912-3.268.93-1.066 3.027-.068 4.627 1.21 1.936 2.172 4.095 3.24 6.1 1.189 2.241 2.172 3.303 4.041 4.981Z"/> +<path fill="#c9e7f6" d="M22.067 43.815c.028.964 2.948 4.393 3.92 4.742.95.343 2.18-.334 2.734-1.09.762-1.034.252-1.574-.064-2.687"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M22.067 43.815c.028.964 2.948 4.393 3.92 4.742.95.343 2.18-.334 2.734-1.09.762-1.034.252-1.574-.064-2.687"/> +<path fill="#c9e7f6" d="M22.11 36.904c-1.137-2.36-2.629-4.552-4.99-4.643"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M22.11 36.904c-1.137-2.36-2.629-4.552-4.99-4.643"/> +<path fill="#c9e7f6" d="M17.435 39.92c-.864-.35-1.984-2.365-2.672-3.004"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M17.435 39.92c-.864-.35-1.984-2.365-2.672-3.004"/> +<path fill="#c9e7f6" d="M13.153 45.347c1.788.902 4.271 1.132 6.227 2.028 1.33.612 4.64 3.029 5.283.246"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M13.153 45.347c1.788.902 4.271 1.132 6.227 2.028 1.33.612 4.64 3.029 5.283.246"/> +<path fill="#c9e7f6" d="M26.685 48.64c-.194 1.553 1.607 5.475 3.056 6.033"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M26.685 48.64c-.194 1.553 1.607 5.475 3.056 6.033"/> +<path fill="#c9e7f6" d="M36.363 53.787c1.52-.763 1.7-3.222 1.734-4.663"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M36.363 53.787c1.52-.763 1.7-3.222 1.734-4.663"/> +<path fill="#c9e7f6" d="M24.767 44.97c.044-.105-.142-.3.06-.206.232 1.135.497 1.916 1.656 1.864 1.346-.06 1.734-1.053 1.373-1.921"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M24.767 44.97c.044-.105-.142-.3.06-.206.232 1.135.497 1.916 1.656 1.864 1.346-.06 1.734-1.053 1.373-1.921"/> +<path fill="#c9e7f6" d="M23.027 45.807c-.366.088-.774.366-1.094.548.378 1.145 1.726 1.873 2.794 1.082"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M23.027 45.807c-.366.088-.774.366-1.094.548.378 1.145 1.726 1.873 2.794 1.082"/> +<path fill="#c9e7f6" d="M9.147 16.643c.71-.547 1.516-.948 2.185-1.51"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M9.147 16.643c.71-.547 1.516-.948 2.185-1.51"/> +<path fill="#c9e7f6" d="M23.459 9.145c.205.456 3.172-.005 3.95-.062"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M23.459 9.145c.205.456 3.172-.005 3.95-.062"/> +<path fill="#c9e7f6" d="M24.967 15.467c.777.642 2.55.461 3.393.05"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M24.967 15.467c.777.642 2.55.461 3.393.05"/> +<path fill="#c9e7f6" d="M12.273 22.184c.827-.956 2.439-1.7 3.438-2.725"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M12.273 22.184c.827-.956 2.439-1.7 3.438-2.725"/> +<path fill="#c9e7f6" d="M15.327 48.59c-.05-.018-.378 0-.2-.058.706-.39 1.701-1.087 2.141-1.641"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M15.327 48.59c-.05-.018-.378 0-.2-.058.706-.39 1.701-1.087 2.141-1.641"/> +<path fill="#c9e7f6" d="M28.292 32.245c.01 1.31-.49 2.995-.867 4.248"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M28.292 32.245c.01 1.31-.49 2.995-.867 4.248"/> +<path fill="#c9e7f6" d="M35.592 39.455c3.513.042 1.235 6.358.215 6.176"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M35.592 39.455c3.513.042 1.235 6.358.215 6.176"/> +<path fill="#c9e7f6" d="M33.703 37.757c-1.046 1.09-4.423.055-5.642-.492-1.912-.86-3.79-1.188-5.872-.586-1.685.488-4.242 1.362-4.461 3.44-.233 2.222 2.476 3.273 4.197 3.726 3.288.87 6.608.776 9.867 1.724"/> +<path fill="none" stroke="#34699f" stroke-width=".9999974999999999" d="M33.703 37.757c-1.046 1.09-4.423.055-5.642-.492-1.912-.86-3.79-1.188-5.872-.586-1.685.488-4.242 1.362-4.461 3.44-.233 2.222 2.476 3.273 4.197 3.726 3.288.87 6.608.776 9.867 1.724"/> +<path fill="#c9e7f6" d="M0 0c-.251-1.043-.621-1.581-1.709-1.516-.864.051-1.969.639-1.608 1.67.739 2.116 4.618 1.012 2.745-1.349" transform="matrix(1.33333 0 0 -1.33333 23.719 40.57)"/> +<path fill="none" stroke="#34699f" stroke-width=".75" d="M0 0c-.251-1.043-.621-1.581-1.709-1.516-.864.051-1.969.639-1.608 1.67.739 2.116 4.618 1.012 2.745-1.349" transform="matrix(1.33333 0 0 -1.33333 23.719 40.57)"/> +</svg> @@ -6,7 +6,7 @@ <meta name="theme-color" content="#444"> <meta charset="utf-8"> <title>1989</title> -<link rel="icon" href="favicon.png"> +<link rel="icon" href="images/Hammer_and_sickle.svg"> <link rel="stylesheet" href="/fonts/fonts.css"> <link rel="stylesheet" href="/common/client.css"> <link rel="stylesheet" href="play.css"> @@ -1,5 +1,314 @@ "use strict" +// vim:set foldmethod=marker: + +/* global view, roles, send_action, action_button, scroll_into_view */ +/* global spaces, cards, power_cards */ + +// 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) { @@ -22,9 +331,30 @@ const last_space = 74 const last_card = 110 const last_power_card = 54 -const countries = [ "Poland", "Hungary", "East_Germany", "Bulgaria", "Czechoslovakia", "Romania" ] -const board_events = [ 2, 9, 69, 97 ] -const box_events = [ 15, 24, 26, 39, 48, 49, 53, 58, 59, 65, 70, 73, 100, 101, 104 ] +const board_events = [ + C_SOLIDARITY_LEGALIZED, + C_THE_WALL, + C_SYSTEMATIZATION, + C_THE_TYRANT_IS_GONE +] + +const box_events = [ + C_HONECKER, + C_ST_NICHOLAS_CHURCH, + C_HELSINKI_FINAL_ACT, + C_ECO_GLASNOST, + C_WE_ARE_THE_PEOPLE, + C_FOREIGN_CURRENCY_DEBT_BURDEN, + C_LI_PENG, + C_AUSTRIA_HUNGARY_BORDER_REOPENED, + C_GRENZTRUPPEN, + C_PRESIDENTIAL_VISIT, + C_SECURITATE, + C_LASZLO_TOKES, + C_STAND_FAST, + C_ELENA, + C_NEW_YEARS_EVE_PARTY, +] const ui = { favicon: document.getElementById("favicon"), @@ -76,8 +406,8 @@ function create_ui() { for (let s = 1; s <= last_space; ++s) { let info = spaces[s] let [ x, y, w, h ] = LAYOUT[info.ascii_name] - let xc = Math.round( x + w / 2 ) - let yc = Math.round( y + h / 2 ) + let xc = Math.round(x + w / 2) + let yc = Math.round(y + h / 2) x -= 6 y -= 6 w += 12 @@ -96,14 +426,14 @@ function create_ui() { let com_e = document.createElement("div") com_e.className = "marker comInfl hide" - com_e.style.left = (xc + 32 - 25) + "px" - com_e.style.top = (yc + 12 - 25) + "px" + com_e.style.left = xc + 32 - 25 + "px" + com_e.style.top = yc + 12 - 25 + "px" ui.com_inf[s] = com_e let dem_e = document.createElement("div") dem_e.className = "marker demInfl hide" - dem_e.style.left = (xc - 32 - 25) + "px" - dem_e.style.top = (yc + 12 - 25) + "px" + dem_e.style.left = xc - 32 - 25 + "px" + dem_e.style.top = yc + 12 - 25 + "px" ui.dem_inf[s] = dem_e document.getElementById("spaces").append(space_e) @@ -111,7 +441,6 @@ function create_ui() { document.getElementById("markers").appendChild(dem_e) } - ui.cards = [] for (let c = 1; c <= last_card; ++c) { const card_e = document.createElement("div") @@ -150,76 +479,20 @@ function create_ui() { create_country(5, "country_romania") } -// SUPPORTING FUNCTIONS - -function on_click_space(evt) { - if (evt.button === 0) { - const space = evt.target.my_space - //console.log('on_click_space_called with space:', space); - if (send_action("space", space)) { - console.log('send_action with space:', space); - evt.stopPropagation() - } else if (send_action("sc", space)) { - //console.log('send_action with sc:', space); - evt.stopPropagation() - } else { - // console.log('send_action failed for space:', space); - } - } - //hide_popup_menu(); -} - -function on_log(text) { - // eslint-disable-line no-unused-vars - - let p = document.createElement("div") - - if (text.match(/^>/)) { - text = text.substring(1) - p.className = "i" - } - - text = text.replace(/_/g, " ") - text = text.replace(/C(\d+)/g, sub_card_name) - text = text.replace(/P(\d+)/g, sub_power_card_name) - text = text.replace(/V(\d+)/g, sub_power_card_value) - text = text.replace(/%(\d+)/g, sub_space_name) - text = text.replace(/D[1-6]/g, sub_die) - - if (text.match(/^\.h1/)) { - text = text.substring(4) - p.className = "h1" - } else if (text.match(/^\.h2d/)) { - text = text.substring(5) - p.className = "h2 dem" - } else if (text.match(/^\.h2c/)) { - text = text.substring(5) - p.className = "h2 com" - } else if (text.match(/^\.h2/)) { - text = text.substring(4) - p.className = "h2" - } else if (text.match(/^\.h3/)) { - text = text.substring(4) - p.className = "h3" - } - - p.innerHTML = text - return p -} - function layout_turn_marker() { let x = 654 + 24 + (view.turn - 1) * 53 let y = 80 + 24 - ui.turn.style.left = (x - 25) + "px" - ui.turn.style.top = (y - 25) + "px" + ui.turn.style.left = x - 25 + "px" + ui.turn.style.top = y - 25 + "px" } function layout_round_marker() { let x = 709 + 24 + (view.turn - 1) * 53 let y = 142 + 24 - ui.round.style.left = (x - 25) + "px" - ui.round.style.top = (y - 25) + "px" - if (view.round_player === "Democrat") // TODO: bit flag? + ui.round.style.left = x - 25 + "px" + ui.round.style.top = y - 25 + "px" + if (view.round_player === "Democrat") + // TODO: bit flag? ui.round.className = "marker dem" else ui.round.className = "marker com" @@ -228,18 +501,18 @@ function layout_round_marker() { function layout_stability_marker() { let x = 24 + 1381 let y = 24 + 1081 + view.stability * 54 - ui.stability.style.left = (x - 25) + "px" - ui.stability.style.top = (y - 25) + "px" + ui.stability.style.left = x - 25 + "px" + ui.stability.style.top = y - 25 + "px" } -let TST_X = [ 53, 53+69, 53+69*2, 53+69*3, 53+69*4, 53+69*5, 53+69*6, 556 ] +let TST_X = [ 53, 53 + 69, 53 + 69 * 2, 53 + 69 * 3, 53 + 69 * 4, 53 + 69 * 5, 53 + 69 * 6, 556 ] let TST_Y = [ 2128, 2257 ] function layout_tst_marker(e, v, top) { let x = TST_X[v] + 24 let y = TST_Y[top] + 24 - e.style.left = (x - 25) + "px" - e.style.top = (y - 25) + "px" + e.style.left = x - 25 + "px" + e.style.top = y - 25 + "px" } function layout_vp_marker() { @@ -247,27 +520,25 @@ function layout_vp_marker() { if (view.vp === 0) { y = 2425 + 25 x = 843 + 28 - } - else if (view.vp < 0) { + } else if (view.vp < 0) { if (view.vp & 1) { y = 2456 + 25 - x = 803 + 28 - (-view.vp - 1)/2 * 62 + x = 803 + 28 - ((-view.vp - 1) / 2) * 62 } else { y = 2395 + 25 - x = 772 + 28 - (-view.vp - 2)/2 * 62 + x = 772 + 28 - ((-view.vp - 2) / 2) * 62 } - } - else if (view.vp > 0) { + } else if (view.vp > 0) { if (view.vp & 1) { y = 2396 + 25 - x = 883 + 28 + (view.vp - 1)/2 * 62 + x = 883 + 28 + ((view.vp - 1) / 2) * 62 } else { y = 2455 + 25 - x = 913 + 28 + (view.vp - 2)/2 * 62 + x = 913 + 28 + ((view.vp - 2) / 2) * 62 } } - ui.vp.style.left = (x - 25) + "px" - ui.vp.style.top = (y - 25) + "px" + ui.vp.style.left = x - 25 + "px" + ui.vp.style.top = y - 25 + "px" } function layout_country(id) { @@ -309,30 +580,30 @@ function on_update() { // UPDATE EVENT MARKERS ON THE BOARD - if (view.persistent_events.includes(2)) - ui.events[2].style.display = "block" + if (view.persistent_events.includes(C_SOLIDARITY_LEGALIZED)) + ui.events[C_SOLIDARITY_LEGALIZED].style.display = "block" else - ui.events[2].style.display = "none" + ui.events[C_SOLIDARITY_LEGALIZED].style.display = "none" - if (view.persistent_events.includes(9)) - ui.events[9].style.display = "block" + if (view.persistent_events.includes(C_THE_WALL)) + ui.events[C_THE_WALL].style.display = "block" else - ui.events[9].style.display = "none" + ui.events[C_THE_WALL].style.display = "none" if (view.persistent_events.includes(69)) { - ui.events[69].style.display = "block" - ui.events[69].style.left = ui.layout_xy[view.systematization][0] - 25 + "px" - ui.events[69].style.top = ui.layout_xy[view.systematization][1] - 25 + "px" + ui.events[C_SYSTEMATIZATION].style.display = "block" + ui.events[C_SYSTEMATIZATION].style.left = ui.layout_xy[view.systematization][0] - 25 + "px" + ui.events[C_SYSTEMATIZATION].style.top = ui.layout_xy[view.systematization][1] - 25 + "px" } else { - ui.events[69].style.display = "none" + ui.events[C_SYSTEMATIZATION].style.display = "none" } - if (view.persistent_events.includes(97)) { - ui.events[97].style.display = "block" - ui.events[97].style.left = ui.layout_xy[view.the_tyrant_is_gone][0] - 25 + "px" - ui.events[97].style.top = ui.layout_xy[view.the_tyrant_is_gone][1] - 25 + "px" + if (view.persistent_events.includes(C_THE_TYRANT_IS_GONE)) { + ui.events[C_THE_TYRANT_IS_GONE].style.display = "block" + ui.events[C_THE_TYRANT_IS_GONE].style.left = ui.layout_xy[view.the_tyrant_is_gone][0] - 25 + "px" + ui.events[C_THE_TYRANT_IS_GONE].style.top = ui.layout_xy[view.the_tyrant_is_gone][1] - 25 + "px" } else { - ui.events[97].style.display = "none" + ui.events[C_THE_TYRANT_IS_GONE].style.display = "none" } // EVENT REMINDER LIST @@ -475,22 +746,22 @@ function on_update() { // =========================== LOG FUNCTIONS ============================================== -function sub_card_name(match, p1) { +function sub_card_name(_match, p1) { let x = p1 | 0 return `<span class="card_name" onmouseenter="on_focus_card_tip(${x})" onmouseleave="on_blur_card_tip()">${cards[x].name}</span>` } -function sub_power_card_name(match, p1) { +function sub_power_card_name(_match, p1) { let x = p1 | 0 return `<span class="card_name" onmouseenter="on_focus_power_card_tip(${x})" onmouseleave="on_blur_power_card_tip()">${power_cards[x].name}</span>` } -function sub_power_card_value(match, p1) { +function sub_power_card_value(_match, p1) { let x = p1 | 0 return `<span class="card_name">${x}</span>` } -function sub_space_name(match, p1) { +function sub_space_name(_match, p1) { let id = p1 | 0 let name = spaces[id].name_unique return `<span class="space_tip" onmouseenter="on_focus_space_tip(${id})" onmouseleave="on_blur_space_tip(${id})" onclick="on_click_space_tip(${id})">${name}</span>` @@ -509,6 +780,42 @@ const die = { D6: '<span class="die white d6"></span>', } +function on_log(text) { + let p = document.createElement("div") + + if (text.match(/^>/)) { + text = text.substring(1) + p.className = "i" + } + + text = text.replace(/_/g, " ") + text = text.replace(/C(\d+)/g, sub_card_name) + text = text.replace(/P(\d+)/g, sub_power_card_name) + text = text.replace(/V(\d+)/g, sub_power_card_value) + text = text.replace(/%(\d+)/g, sub_space_name) + text = text.replace(/D[1-6]/g, sub_die) + + if (text.match(/^\.h1/)) { + text = text.substring(4) + p.className = "h1" + } else if (text.match(/^\.h2d/)) { + text = text.substring(5) + p.className = "h2 dem" + } else if (text.match(/^\.h2c/)) { + text = text.substring(5) + p.className = "h2 com" + } else if (text.match(/^\.h2/)) { + text = text.substring(4) + p.className = "h2" + } else if (text.match(/^\.h3/)) { + text = text.substring(4) + p.className = "h3" + } + + p.innerHTML = text + return p +} + // =========================== VISUAL FUNCTIONS ==========================================# function on_focus_card_tip(card_number) { @@ -546,119 +853,3 @@ function toggle_discard() { function toggle_removed() { document.getElementById("removed_panel").classList.toggle("hide") } - -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 @@ -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("") |