powergrid-engine 1.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -0
  3. package/dist/index.d.ts +6 -0
  4. package/dist/index.js +17 -0
  5. package/dist/src/available-moves.d.ts +24 -0
  6. package/dist/src/available-moves.js +363 -0
  7. package/dist/src/engine.d.ts +20 -0
  8. package/dist/src/engine.js +1937 -0
  9. package/dist/src/gamestate.d.ts +135 -0
  10. package/dist/src/gamestate.js +30 -0
  11. package/dist/src/log.d.ts +14 -0
  12. package/dist/src/log.js +2 -0
  13. package/dist/src/maps/america.d.ts +55 -0
  14. package/dist/src/maps/america.js +411 -0
  15. package/dist/src/maps/australia.d.ts +46 -0
  16. package/dist/src/maps/australia.js +138 -0
  17. package/dist/src/maps/badenwurttemberg.d.ts +46 -0
  18. package/dist/src/maps/badenwurttemberg.js +163 -0
  19. package/dist/src/maps/benelux.d.ts +46 -0
  20. package/dist/src/maps/benelux.js +210 -0
  21. package/dist/src/maps/brazil.d.ts +54 -0
  22. package/dist/src/maps/brazil.js +292 -0
  23. package/dist/src/maps/centraleurope.d.ts +54 -0
  24. package/dist/src/maps/centraleurope.js +236 -0
  25. package/dist/src/maps/china.d.ts +54 -0
  26. package/dist/src/maps/china.js +262 -0
  27. package/dist/src/maps/france.d.ts +54 -0
  28. package/dist/src/maps/france.js +290 -0
  29. package/dist/src/maps/germany.d.ts +57 -0
  30. package/dist/src/maps/germany.js +328 -0
  31. package/dist/src/maps/indian.d.ts +54 -0
  32. package/dist/src/maps/indian.js +283 -0
  33. package/dist/src/maps/italy.d.ts +54 -0
  34. package/dist/src/maps/italy.js +190 -0
  35. package/dist/src/maps/japan.d.ts +46 -0
  36. package/dist/src/maps/japan.js +144 -0
  37. package/dist/src/maps/korea.d.ts +54 -0
  38. package/dist/src/maps/korea.js +186 -0
  39. package/dist/src/maps/middleeast.d.ts +54 -0
  40. package/dist/src/maps/middleeast.js +225 -0
  41. package/dist/src/maps/northerneurope.d.ts +54 -0
  42. package/dist/src/maps/northerneurope.js +197 -0
  43. package/dist/src/maps/quebec.d.ts +54 -0
  44. package/dist/src/maps/quebec.js +283 -0
  45. package/dist/src/maps/russia.d.ts +54 -0
  46. package/dist/src/maps/russia.js +286 -0
  47. package/dist/src/maps/southafrica.d.ts +46 -0
  48. package/dist/src/maps/southafrica.js +152 -0
  49. package/dist/src/maps/spainportugal.d.ts +54 -0
  50. package/dist/src/maps/spainportugal.js +289 -0
  51. package/dist/src/maps/ukireland.d.ts +52 -0
  52. package/dist/src/maps/ukireland.js +176 -0
  53. package/dist/src/maps.d.ts +50 -0
  54. package/dist/src/maps.js +61 -0
  55. package/dist/src/move.d.ts +63 -0
  56. package/dist/src/move.js +15 -0
  57. package/dist/src/powerPlants.d.ts +4 -0
  58. package/dist/src/powerPlants.js +60 -0
  59. package/dist/src/prices.d.ts +7 -0
  60. package/dist/src/prices.js +10 -0
  61. package/dist/src/randomizeMap.d.ts +3 -0
  62. package/dist/src/randomizeMap.js +244 -0
  63. package/dist/src/utils.d.ts +2 -0
  64. package/dist/src/utils.js +24 -0
  65. package/dist/wrapper.d.ts +30 -0
  66. package/dist/wrapper.js +127 -0
  67. package/index.ts +6 -0
  68. package/package.json +51 -0
  69. package/src/available-moves.ts +450 -0
  70. package/src/engine.spec.ts +163 -0
  71. package/src/engine.ts +2270 -0
  72. package/src/fixtures/GermanyRecharged.json +6627 -0
  73. package/src/fixtures/USAOriginal.json +5216 -0
  74. package/src/fixtures/supply.json +5792 -0
  75. package/src/fixtures/undo.json +4102 -0
  76. package/src/gamestate.ts +164 -0
  77. package/src/log.ts +17 -0
  78. package/src/maps/america.ts +411 -0
  79. package/src/maps/australia.ts +137 -0
  80. package/src/maps/badenwurttemberg.ts +162 -0
  81. package/src/maps/benelux.ts +210 -0
  82. package/src/maps/brazil.ts +306 -0
  83. package/src/maps/centraleurope.ts +235 -0
  84. package/src/maps/china.ts +268 -0
  85. package/src/maps/france.ts +295 -0
  86. package/src/maps/germany.ts +328 -0
  87. package/src/maps/indian.ts +289 -0
  88. package/src/maps/italy.ts +189 -0
  89. package/src/maps/japan.ts +143 -0
  90. package/src/maps/korea.ts +185 -0
  91. package/src/maps/middleeast.ts +225 -0
  92. package/src/maps/northerneurope.ts +196 -0
  93. package/src/maps/quebec.ts +304 -0
  94. package/src/maps/russia.ts +292 -0
  95. package/src/maps/southafrica.ts +151 -0
  96. package/src/maps/spainportugal.ts +295 -0
  97. package/src/maps/ukireland.ts +175 -0
  98. package/src/maps.ts +123 -0
  99. package/src/move.ts +83 -0
  100. package/src/powerPlants.ts +59 -0
  101. package/src/prices.ts +10 -0
  102. package/src/randomizeMap.ts +288 -0
  103. package/src/rankings.spec.ts +18 -0
  104. package/src/utils.spec.ts +13 -0
  105. package/src/utils.ts +23 -0
  106. package/tsconfig.json +17 -0
  107. package/wrapper.ts +126 -0
@@ -0,0 +1,289 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.map = exports.Cities = exports.Regions = void 0;
4
+ const lodash_1 = require("lodash");
5
+ const engine_1 = require("../engine");
6
+ const powerPlants_1 = require("../powerPlants");
7
+ const utils_1 = require("../utils");
8
+ var Regions;
9
+ (function (Regions) {
10
+ Regions["Pink"] = "pink";
11
+ Regions["Brown"] = "brown";
12
+ Regions["Green"] = "green";
13
+ Regions["Purple"] = "purple";
14
+ Regions["Red"] = "red";
15
+ Regions["Yellow"] = "yellow";
16
+ })(Regions = exports.Regions || (exports.Regions = {}));
17
+ var Cities;
18
+ (function (Cities) {
19
+ Cities["Gerona"] = "Gerona";
20
+ Cities["Barcelona"] = "Barcelona";
21
+ Cities["Tarragona"] = "Tarragona";
22
+ Cities["Lerida"] = "Lerida";
23
+ Cities["Castellondelaplana"] = "Castellon De La Plana";
24
+ Cities["Valencia"] = "Valencia";
25
+ Cities["Alicante"] = "Alicante";
26
+ Cities["Sansebastian"] = "San Sebastian";
27
+ Cities["Pamplona"] = "Pamplona";
28
+ Cities["Zaragoza"] = "Zaragoza";
29
+ Cities["Madrid"] = "Madrid";
30
+ Cities["Logrono"] = "Logrono";
31
+ Cities["Bilbao"] = "Bilbao";
32
+ Cities["Santander"] = "Santander";
33
+ Cities["Gijon"] = "Gijon";
34
+ Cities["Leon"] = "Leon";
35
+ Cities["Valladolid"] = "Valladolid";
36
+ Cities["Salamanca"] = "Salamanca";
37
+ Cities["Orense"] = "Orense";
38
+ Cities["Lacoruna"] = "La Coruna";
39
+ Cities["Santiagodecompostela"] = "Santiago De Compostela";
40
+ Cities["Cuenca"] = "Cuenca";
41
+ Cities["Albacete"] = "Albacete";
42
+ Cities["Murcia"] = "Murcia";
43
+ Cities["Toledo"] = "Toledo";
44
+ Cities["Ciudadreal"] = "Ciudad Real";
45
+ Cities["Caceres"] = "Caceres";
46
+ Cities["Merida"] = "Merida";
47
+ Cities["Almeria"] = "Almeria";
48
+ Cities["Granada"] = "Granada";
49
+ Cities["Cordoba"] = "Cordoba";
50
+ Cities["Malaga"] = "Malaga";
51
+ Cities["Cadiz"] = "Cadiz";
52
+ Cities["Sevilla"] = "Sevilla";
53
+ Cities["Huelva"] = "Huelva";
54
+ Cities["Evora"] = "Evora";
55
+ Cities["Faro"] = "Faro";
56
+ Cities["Portimao"] = "Portimao";
57
+ Cities["Setubal"] = "Setubal";
58
+ Cities["Lisboa"] = "Lisboa";
59
+ Cities["Porto"] = "Porto";
60
+ Cities["Braga"] = "Braga";
61
+ })(Cities = exports.Cities || (exports.Cities = {}));
62
+ exports.map = {
63
+ name: 'Spain & Portugal',
64
+ cities: [
65
+ { name: Cities.Evora, region: Regions.Yellow, x: 890, y: 1780 },
66
+ { name: Cities.Faro, region: Regions.Yellow, x: 822, y: 2348 },
67
+ { name: Cities.Portimao, region: Regions.Yellow, x: 592, y: 2218 },
68
+ { name: Cities.Setubal, region: Regions.Yellow, x: 578, y: 1864 },
69
+ { name: Cities.Lisboa, region: Regions.Yellow, x: 572, y: 1586 },
70
+ { name: Cities.Porto, region: Regions.Yellow, x: 736, y: 1052 },
71
+ { name: Cities.Braga, region: Regions.Yellow, x: 990, y: 828 },
72
+ { name: Cities.Gerona, region: Regions.Pink, x: 3728, y: 666 },
73
+ { name: Cities.Barcelona, region: Regions.Pink, x: 3538, y: 848 },
74
+ { name: Cities.Tarragona, region: Regions.Pink, x: 3312, y: 970 },
75
+ { name: Cities.Lerida, region: Regions.Pink, x: 3166, y: 752 },
76
+ { name: Cities.Castellondelaplana, region: Regions.Pink, x: 3010, y: 1284 },
77
+ { name: Cities.Valencia, region: Regions.Pink, x: 2938, y: 1580 },
78
+ { name: Cities.Alicante, region: Regions.Pink, x: 2936, y: 1922 },
79
+ { name: Cities.Sansebastian, region: Regions.Brown, x: 2498, y: 278 },
80
+ { name: Cities.Pamplona, region: Regions.Brown, x: 2648, y: 484 },
81
+ { name: Cities.Zaragoza, region: Regions.Brown, x: 2760, y: 810 },
82
+ { name: Cities.Madrid, region: Regions.Brown, x: 2088, y: 1170 },
83
+ { name: Cities.Logrono, region: Regions.Brown, x: 2310, y: 622 },
84
+ { name: Cities.Bilbao, region: Regions.Brown, x: 2264, y: 226 },
85
+ { name: Cities.Santander, region: Regions.Brown, x: 2022, y: 252 },
86
+ { name: Cities.Gijon, region: Regions.Green, x: 1672, y: 190 },
87
+ { name: Cities.Leon, region: Regions.Green, x: 1604, y: 518 },
88
+ { name: Cities.Valladolid, region: Regions.Green, x: 1850, y: 782 },
89
+ { name: Cities.Salamanca, region: Regions.Green, x: 1564, y: 1032 },
90
+ { name: Cities.Orense, region: Regions.Green, x: 1072, y: 532 },
91
+ { name: Cities.Lacoruna, region: Regions.Green, x: 982, y: 184 },
92
+ { name: Cities.Santiagodecompostela, region: Regions.Green, x: 772, y: 394 },
93
+ { name: Cities.Cuenca, region: Regions.Purple, x: 2464, y: 1300 },
94
+ { name: Cities.Albacete, region: Regions.Purple, x: 2532, y: 1684 },
95
+ { name: Cities.Murcia, region: Regions.Purple, x: 2678, y: 2056 },
96
+ { name: Cities.Toledo, region: Regions.Purple, x: 1920, y: 1400 },
97
+ { name: Cities.Ciudadreal, region: Regions.Purple, x: 1982, y: 1714 },
98
+ { name: Cities.Caceres, region: Regions.Purple, x: 1354, y: 1432 },
99
+ { name: Cities.Merida, region: Regions.Purple, x: 1318, y: 1764 },
100
+ { name: Cities.Almeria, region: Regions.Red, x: 2402, y: 2440 },
101
+ { name: Cities.Granada, region: Regions.Red, x: 2044, y: 2272 },
102
+ { name: Cities.Cordoba, region: Regions.Red, x: 1728, y: 2074 },
103
+ { name: Cities.Malaga, region: Regions.Red, x: 1782, y: 2484 },
104
+ { name: Cities.Cadiz, region: Regions.Red, x: 1290, y: 2552 },
105
+ { name: Cities.Sevilla, region: Regions.Red, x: 1390, y: 2168 },
106
+ { name: Cities.Huelva, region: Regions.Red, x: 1082, y: 2196 },
107
+ ],
108
+ connections: [
109
+ { nodes: [Cities.Huelva, Cities.Faro], cost: 6 },
110
+ { nodes: [Cities.Faro, Cities.Portimao], cost: 4 },
111
+ { nodes: [Cities.Portimao, Cities.Setubal], cost: 12 },
112
+ { nodes: [Cities.Setubal, Cities.Evora], cost: 6 },
113
+ { nodes: [Cities.Evora, Cities.Merida], cost: 9 },
114
+ { nodes: [Cities.Merida, Cities.Sevilla], cost: 14 },
115
+ { nodes: [Cities.Sevilla, Cities.Cadiz], cost: 8 },
116
+ { nodes: [Cities.Cadiz, Cities.Malaga], cost: 12 },
117
+ { nodes: [Cities.Malaga, Cities.Granada], cost: 7 },
118
+ { nodes: [Cities.Granada, Cities.Almeria], cost: 9 },
119
+ { nodes: [Cities.Almeria, Cities.Murcia], cost: 13 },
120
+ { nodes: [Cities.Murcia, Cities.Alicante], cost: 4 },
121
+ { nodes: [Cities.Alicante, Cities.Valencia], cost: 9 },
122
+ { nodes: [Cities.Valencia, Cities.Castellondelaplana], cost: 4 },
123
+ { nodes: [Cities.Albacete, Cities.Almeria], cost: 19 },
124
+ { nodes: [Cities.Albacete, Cities.Murcia], cost: 10 },
125
+ { nodes: [Cities.Albacete, Cities.Alicante], cost: 11 },
126
+ { nodes: [Cities.Albacete, Cities.Valencia], cost: 11 },
127
+ { nodes: [Cities.Albacete, Cities.Cuenca], cost: 8 },
128
+ { nodes: [Cities.Albacete, Cities.Ciudadreal], cost: 13 },
129
+ { nodes: [Cities.Albacete, Cities.Granada], cost: 19 },
130
+ { nodes: [Cities.Albacete, Cities.Toledo], cost: 14 },
131
+ { nodes: [Cities.Toledo, Cities.Madrid], cost: 6 },
132
+ { nodes: [Cities.Madrid, Cities.Cuenca], cost: 11 },
133
+ { nodes: [Cities.Cuenca, Cities.Valencia], cost: 13 },
134
+ { nodes: [Cities.Cuenca, Cities.Castellondelaplana], cost: 14 },
135
+ { nodes: [Cities.Castellondelaplana, Cities.Tarragona], cost: 12 },
136
+ { nodes: [Cities.Toledo, Cities.Caceres], cost: 16 },
137
+ { nodes: [Cities.Caceres, Cities.Merida], cost: 4 },
138
+ { nodes: [Cities.Merida, Cities.Ciudadreal], cost: 16 },
139
+ { nodes: [Cities.Ciudadreal, Cities.Granada], cost: 16 },
140
+ { nodes: [Cities.Granada, Cities.Cordoba], cost: 11 },
141
+ { nodes: [Cities.Cordoba, Cities.Malaga], cost: 11 },
142
+ { nodes: [Cities.Malaga, Cities.Sevilla], cost: 12 },
143
+ { nodes: [Cities.Sevilla, Cities.Cordoba], cost: 8 },
144
+ { nodes: [Cities.Cordoba, Cities.Ciudadreal], cost: 10 },
145
+ { nodes: [Cities.Merida, Cities.Cordoba], cost: 14 },
146
+ { nodes: [Cities.Huelva, Cities.Cadiz], cost: 9 },
147
+ { nodes: [Cities.Huelva, Cities.Sevilla], cost: 6 },
148
+ { nodes: [Cities.Merida, Cities.Huelva], cost: 15 },
149
+ { nodes: [Cities.Huelva, Cities.Evora], cost: 12 },
150
+ { nodes: [Cities.Evora, Cities.Faro], cost: 13 },
151
+ { nodes: [Cities.Faro, Cities.Setubal], cost: 14 },
152
+ { nodes: [Cities.Setubal, Cities.Lisboa], cost: 4 },
153
+ { nodes: [Cities.Lisboa, Cities.Evora], cost: 9 },
154
+ { nodes: [Cities.Lisboa, Cities.Merida], cost: 16 },
155
+ { nodes: [Cities.Caceres, Cities.Ciudadreal], cost: 16 },
156
+ { nodes: [Cities.Toledo, Cities.Cuenca], cost: 13 },
157
+ { nodes: [Cities.Salamanca, Cities.Toledo], cost: 14 },
158
+ { nodes: [Cities.Salamanca, Cities.Madrid], cost: 14 },
159
+ { nodes: [Cities.Salamanca, Cities.Caceres], cost: 13 },
160
+ { nodes: [Cities.Porto, Cities.Lisboa], cost: 18 },
161
+ { nodes: [Cities.Porto, Cities.Salamanca], cost: 19 },
162
+ { nodes: [Cities.Porto, Cities.Caceres], cost: 21 },
163
+ { nodes: [Cities.Caceres, Cities.Lisboa], cost: 19 },
164
+ { nodes: [Cities.Ciudadreal, Cities.Toledo], cost: 7 },
165
+ { nodes: [Cities.Braga, Cities.Porto], cost: 3 },
166
+ { nodes: [Cities.Braga, Cities.Salamanca], cost: 19 },
167
+ { nodes: [Cities.Salamanca, Cities.Valladolid], cost: 7 },
168
+ { nodes: [Cities.Valladolid, Cities.Madrid], cost: 13 },
169
+ { nodes: [Cities.Madrid, Cities.Zaragoza], cost: 19 },
170
+ { nodes: [Cities.Zaragoza, Cities.Lerida], cost: 8 },
171
+ { nodes: [Cities.Lerida, Cities.Tarragona], cost: 6 },
172
+ { nodes: [Cities.Tarragona, Cities.Barcelona], cost: 6 },
173
+ { nodes: [Cities.Lerida, Cities.Castellondelaplana], cost: 13 },
174
+ { nodes: [Cities.Castellondelaplana, Cities.Zaragoza], cost: 15 },
175
+ { nodes: [Cities.Zaragoza, Cities.Cuenca], cost: 16 },
176
+ { nodes: [Cities.Braga, Cities.Valladolid], cost: 24 },
177
+ { nodes: [Cities.Lerida, Cities.Barcelona], cost: 10 },
178
+ { nodes: [Cities.Barcelona, Cities.Gerona], cost: 6 },
179
+ { nodes: [Cities.Gerona, Cities.Lerida], cost: 13 },
180
+ { nodes: [Cities.Lerida, Cities.Pamplona], cost: 17 },
181
+ { nodes: [Cities.Pamplona, Cities.Zaragoza], cost: 11 },
182
+ { nodes: [Cities.Zaragoza, Cities.Logrono], cost: 11 },
183
+ { nodes: [Cities.Logrono, Cities.Madrid], cost: 18 },
184
+ { nodes: [Cities.Santiagodecompostela, Cities.Braga], cost: 11 },
185
+ { nodes: [Cities.Braga, Cities.Orense], cost: 9 },
186
+ { nodes: [Cities.Orense, Cities.Santiagodecompostela], cost: 7 },
187
+ { nodes: [Cities.Santiagodecompostela, Cities.Lacoruna], cost: 4 },
188
+ { nodes: [Cities.Lacoruna, Cities.Gijon], cost: 9 },
189
+ { nodes: [Cities.Gijon, Cities.Santander], cost: 11 },
190
+ { nodes: [Cities.Santander, Cities.Bilbao], cost: 6 },
191
+ { nodes: [Cities.Bilbao, Cities.Sansebastian], cost: 5 },
192
+ { nodes: [Cities.Sansebastian, Cities.Pamplona], cost: 6 },
193
+ { nodes: [Cities.Pamplona, Cities.Logrono], cost: 7 },
194
+ { nodes: [Cities.Logrono, Cities.Sansebastian], cost: 9 },
195
+ { nodes: [Cities.Bilbao, Cities.Logrono], cost: 9 },
196
+ { nodes: [Cities.Logrono, Cities.Santander], cost: 13 },
197
+ { nodes: [Cities.Santander, Cities.Valladolid], cost: 16 },
198
+ { nodes: [Cities.Valladolid, Cities.Logrono], cost: 15 },
199
+ { nodes: [Cities.Leon, Cities.Santander], cost: 13 },
200
+ { nodes: [Cities.Gijon, Cities.Leon], cost: 9 },
201
+ { nodes: [Cities.Leon, Cities.Valladolid], cost: 9 },
202
+ { nodes: [Cities.Valladolid, Cities.Orense], cost: 22 },
203
+ { nodes: [Cities.Orense, Cities.Leon], cost: 14 },
204
+ { nodes: [Cities.Gijon, Cities.Orense], cost: 10 },
205
+ { nodes: [Cities.Orense, Cities.Lacoruna], cost: 6 },
206
+ ],
207
+ layout: 'Portrait',
208
+ adjustRatio: [0.315, 0.315],
209
+ mapPosition: [-135, 60],
210
+ resupply: [
211
+ [
212
+ [3, 4, 2],
213
+ [4, 5, 2],
214
+ [4, 6, 3],
215
+ [4, 7, 3],
216
+ [6, 8, 4],
217
+ ],
218
+ [
219
+ [2, 3, 5],
220
+ [2, 4, 5],
221
+ [3, 5, 6],
222
+ [4, 6, 7],
223
+ [5, 7, 9],
224
+ ],
225
+ [
226
+ [1, 2, 3],
227
+ [1, 2, 3],
228
+ [2, 3, 4],
229
+ [3, 3, 5],
230
+ [3, 5, 6],
231
+ ],
232
+ [
233
+ [0, 2, 1],
234
+ [0, 2, 1],
235
+ [0, 4, 1],
236
+ [0, 5, 1],
237
+ [0, 5, 2],
238
+ ],
239
+ ],
240
+ startingResources: [24, 18, 9, 8],
241
+ setupDeck(numPlayers, variant, rng) {
242
+ let powerPlantsDeck = lodash_1.cloneDeep(powerPlants_1.powerPlants);
243
+ let actualMarket;
244
+ let futureMarket;
245
+ // remove plants 18 22 and 27
246
+ powerPlantsDeck = powerPlantsDeck.filter((pp) => ![18, 22, 27].includes(pp.number));
247
+ if (variant == 'original') {
248
+ powerPlantsDeck = powerPlantsDeck.slice(8);
249
+ const powerPlant13 = powerPlantsDeck.splice(2, 1)[0];
250
+ const step3 = powerPlantsDeck.pop();
251
+ powerPlantsDeck = utils_1.shuffle(powerPlantsDeck, rng() + '');
252
+ if (numPlayers == 2 || numPlayers == 3) {
253
+ powerPlantsDeck = powerPlantsDeck.slice(8);
254
+ }
255
+ else if (numPlayers == 4) {
256
+ powerPlantsDeck = powerPlantsDeck.slice(4);
257
+ }
258
+ powerPlantsDeck.unshift(powerPlant13);
259
+ powerPlantsDeck.push(step3);
260
+ actualMarket = [engine_1.getPowerPlant(3), engine_1.getPowerPlant(4), engine_1.getPowerPlant(5), engine_1.getPowerPlant(6)];
261
+ futureMarket = [engine_1.getPowerPlant(7), engine_1.getPowerPlant(8), engine_1.getPowerPlant(9), engine_1.getPowerPlant(10)];
262
+ }
263
+ else {
264
+ let initialPowerPlants = utils_1.shuffle(powerPlantsDeck.splice(0, 13), rng() + '');
265
+ let initialPlantMarket = initialPowerPlants.splice(0, 8);
266
+ initialPlantMarket = initialPlantMarket.sort((a, b) => a.number - b.number);
267
+ actualMarket = initialPlantMarket.slice(0, 4);
268
+ futureMarket = initialPlantMarket.slice(4);
269
+ const first = initialPowerPlants.shift();
270
+ const step3 = powerPlantsDeck.pop();
271
+ powerPlantsDeck = utils_1.shuffle(powerPlantsDeck, rng() + '');
272
+ if (numPlayers == 2 || numPlayers == 3) {
273
+ initialPowerPlants = initialPowerPlants.slice(2);
274
+ powerPlantsDeck = utils_1.shuffle(powerPlantsDeck.slice(6).concat(initialPowerPlants), rng() + '');
275
+ }
276
+ else if (numPlayers == 4) {
277
+ initialPowerPlants = initialPowerPlants.slice(1);
278
+ powerPlantsDeck = utils_1.shuffle(powerPlantsDeck.slice(3).concat(initialPowerPlants), rng() + '');
279
+ }
280
+ else {
281
+ powerPlantsDeck = utils_1.shuffle(powerPlantsDeck.concat(initialPowerPlants), rng() + '');
282
+ }
283
+ powerPlantsDeck.unshift(first);
284
+ powerPlantsDeck.push(step3);
285
+ }
286
+ return { actualMarket, futureMarket, powerPlantsDeck };
287
+ },
288
+ mapSpecificRules: 'Remove power plants 18, 22 and 27 from the deck. Place them on top of the deck at the start of Step 2.\nYou cannot buy a nuclear power plant if you only have cities in Portugal.',
289
+ };
@@ -0,0 +1,52 @@
1
+ import { GameMap } from './../maps';
2
+ export declare enum Regions {
3
+ Red = "red",
4
+ Pink = "pink",
5
+ Yellow = "yellow",
6
+ Brown = "brown",
7
+ Orange = "orange",
8
+ Green = "green"
9
+ }
10
+ export declare enum Cities {
11
+ Norwich = "Norwich",
12
+ London1 = "London 1",
13
+ London2 = "London 2",
14
+ Brighton = "Brighton",
15
+ Southampton = "Southampton",
16
+ Plymouth = "Plymouth",
17
+ Leicester = "Leicester",
18
+ Bristol = "Bristol",
19
+ Newcastleupontyne = "Newcastle Upon Tyne",
20
+ Leeds = "Leeds",
21
+ Sheffield = "Sheffield",
22
+ Nottingham = "Nottingham",
23
+ Birmingham = "Birmingham",
24
+ Manchester = "Manchester",
25
+ Liverpool = "Liverpool",
26
+ Newportcasnewydd = "Newport Casnewydd",
27
+ Bangor = "Bangor",
28
+ Aberystwyth = "Aberystwyth",
29
+ Swanseaabertawe = "Swansea Abertawe",
30
+ Cardiffcaerdydd = "Cardiff Caerdydd",
31
+ Haverfordwesthwlffordd = "Haverfordwest Hwlffordd",
32
+ Invernessinbhirnis = "Inverness Inbhir Nis",
33
+ Aberdeenobardheathain = "Aberdeen Obar Dheathain",
34
+ Dundeedundeach = "Dundee Dun Deach",
35
+ Perthpeairt = "Perth Peairt",
36
+ Edinburgh = "Edinburgh",
37
+ Dumfries = "Dumfries",
38
+ Glasgow = "Glasgow",
39
+ Coleraine = "Coleraine",
40
+ Derry = "Derry",
41
+ Belfast = "Belfast",
42
+ Newry = "Newry",
43
+ Omagh = "Omagh",
44
+ Sligo = "Sligo",
45
+ Dublin = "Dublin",
46
+ Waterford = "Waterford",
47
+ Cork = "Cork",
48
+ Athlone = "Athlone",
49
+ Galway = "Galway",
50
+ Limerick = "Limerick"
51
+ }
52
+ export declare const map: GameMap;
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.map = exports.Cities = exports.Regions = void 0;
4
+ var Regions;
5
+ (function (Regions) {
6
+ Regions["Red"] = "red";
7
+ Regions["Pink"] = "pink";
8
+ Regions["Yellow"] = "yellow";
9
+ Regions["Brown"] = "brown";
10
+ Regions["Orange"] = "orange";
11
+ Regions["Green"] = "green";
12
+ })(Regions = exports.Regions || (exports.Regions = {}));
13
+ var Cities;
14
+ (function (Cities) {
15
+ Cities["Norwich"] = "Norwich";
16
+ Cities["London1"] = "London 1";
17
+ Cities["London2"] = "London 2";
18
+ Cities["Brighton"] = "Brighton";
19
+ Cities["Southampton"] = "Southampton";
20
+ Cities["Plymouth"] = "Plymouth";
21
+ Cities["Leicester"] = "Leicester";
22
+ Cities["Bristol"] = "Bristol";
23
+ Cities["Newcastleupontyne"] = "Newcastle Upon Tyne";
24
+ Cities["Leeds"] = "Leeds";
25
+ Cities["Sheffield"] = "Sheffield";
26
+ Cities["Nottingham"] = "Nottingham";
27
+ Cities["Birmingham"] = "Birmingham";
28
+ Cities["Manchester"] = "Manchester";
29
+ Cities["Liverpool"] = "Liverpool";
30
+ Cities["Newportcasnewydd"] = "Newport Casnewydd";
31
+ Cities["Bangor"] = "Bangor";
32
+ Cities["Aberystwyth"] = "Aberystwyth";
33
+ Cities["Swanseaabertawe"] = "Swansea Abertawe";
34
+ Cities["Cardiffcaerdydd"] = "Cardiff Caerdydd";
35
+ Cities["Haverfordwesthwlffordd"] = "Haverfordwest Hwlffordd";
36
+ Cities["Invernessinbhirnis"] = "Inverness Inbhir Nis";
37
+ Cities["Aberdeenobardheathain"] = "Aberdeen Obar Dheathain";
38
+ Cities["Dundeedundeach"] = "Dundee Dun Deach";
39
+ Cities["Perthpeairt"] = "Perth Peairt";
40
+ Cities["Edinburgh"] = "Edinburgh";
41
+ Cities["Dumfries"] = "Dumfries";
42
+ Cities["Glasgow"] = "Glasgow";
43
+ Cities["Coleraine"] = "Coleraine";
44
+ Cities["Derry"] = "Derry";
45
+ Cities["Belfast"] = "Belfast";
46
+ Cities["Newry"] = "Newry";
47
+ Cities["Omagh"] = "Omagh";
48
+ Cities["Sligo"] = "Sligo";
49
+ Cities["Dublin"] = "Dublin";
50
+ Cities["Waterford"] = "Waterford";
51
+ Cities["Cork"] = "Cork";
52
+ Cities["Athlone"] = "Athlone";
53
+ Cities["Galway"] = "Galway";
54
+ Cities["Limerick"] = "Limerick";
55
+ })(Cities = exports.Cities || (exports.Cities = {}));
56
+ exports.map = {
57
+ name: 'UK & Ireland',
58
+ cities: [
59
+ { name: Cities.Norwich, region: Regions.Red, x: 646, y: 702 },
60
+ { name: Cities.London1, region: Regions.Red, x: 554, y: 756 },
61
+ { name: Cities.London2, region: Regions.Red, x: 550, y: 780 },
62
+ { name: Cities.Brighton, region: Regions.Red, x: 537, y: 837 },
63
+ { name: Cities.Southampton, region: Regions.Red, x: 451, y: 805 },
64
+ { name: Cities.Plymouth, region: Regions.Red, x: 312, y: 814 },
65
+ { name: Cities.Leicester, region: Regions.Red, x: 540, y: 680 },
66
+ { name: Cities.Bristol, region: Regions.Red, x: 425, y: 762 },
67
+ { name: Cities.Newcastleupontyne, region: Regions.Pink, x: 550, y: 414 },
68
+ { name: Cities.Leeds, region: Regions.Pink, x: 559, y: 541 },
69
+ { name: Cities.Sheffield, region: Regions.Pink, x: 530, y: 590 },
70
+ { name: Cities.Nottingham, region: Regions.Pink, x: 531, y: 632 },
71
+ { name: Cities.Birmingham, region: Regions.Pink, x: 465, y: 663 },
72
+ { name: Cities.Manchester, region: Regions.Pink, x: 479, y: 543 },
73
+ { name: Cities.Liverpool, region: Regions.Pink, x: 433, y: 576 },
74
+ { name: Cities.Newportcasnewydd, region: Regions.Yellow, x: 425, y: 722 },
75
+ { name: Cities.Bangor, region: Regions.Yellow, x: 348, y: 574 },
76
+ { name: Cities.Aberystwyth, region: Regions.Yellow, x: 357, y: 639 },
77
+ { name: Cities.Swanseaabertawe, region: Regions.Yellow, x: 346, y: 706 },
78
+ { name: Cities.Cardiffcaerdydd, region: Regions.Yellow, x: 357, y: 741 },
79
+ { name: Cities.Haverfordwesthwlffordd, region: Regions.Yellow, x: 303, y: 673 },
80
+ { name: Cities.Invernessinbhirnis, region: Regions.Brown, x: 479, y: 208 },
81
+ { name: Cities.Aberdeenobardheathain, region: Regions.Brown, x: 588, y: 245 },
82
+ { name: Cities.Dundeedundeach, region: Regions.Brown, x: 552, y: 286 },
83
+ { name: Cities.Perthpeairt, region: Regions.Brown, x: 489, y: 307 },
84
+ { name: Cities.Edinburgh, region: Regions.Brown, x: 494, y: 350 },
85
+ { name: Cities.Dumfries, region: Regions.Brown, x: 441, y: 417 },
86
+ { name: Cities.Glasgow, region: Regions.Brown, x: 422, y: 335 },
87
+ { name: Cities.Coleraine, region: Regions.Orange, x: 330, y: 367 },
88
+ { name: Cities.Derry, region: Regions.Orange, x: 256, y: 362 },
89
+ { name: Cities.Belfast, region: Regions.Orange, x: 342, y: 421 },
90
+ { name: Cities.Newry, region: Regions.Orange, x: 298, y: 462 },
91
+ { name: Cities.Omagh, region: Regions.Orange, x: 260, y: 403 },
92
+ { name: Cities.Sligo, region: Regions.Green, x: 181, y: 411 },
93
+ { name: Cities.Dublin, region: Regions.Green, x: 274, y: 530 },
94
+ { name: Cities.Waterford, region: Regions.Green, x: 210, y: 611 },
95
+ { name: Cities.Cork, region: Regions.Green, x: 114, y: 626 },
96
+ { name: Cities.Athlone, region: Regions.Green, x: 200, y: 489 },
97
+ { name: Cities.Galway, region: Regions.Green, x: 112, y: 486 },
98
+ { name: Cities.Limerick, region: Regions.Green, x: 122, y: 546 },
99
+ ],
100
+ connections: [
101
+ { nodes: [Cities.Nottingham, Cities.Leicester], cost: 4 },
102
+ { nodes: [Cities.London1, Cities.London2], cost: 0 },
103
+ { nodes: [Cities.London2, Cities.Brighton], cost: 6 },
104
+ { nodes: [Cities.Brighton, Cities.Southampton], cost: 7 },
105
+ { nodes: [Cities.Southampton, Cities.Plymouth], cost: 19 },
106
+ { nodes: [Cities.Plymouth, Cities.Bristol], cost: 14 },
107
+ { nodes: [Cities.Bristol, Cities.Newportcasnewydd], cost: 7 },
108
+ { nodes: [Cities.Cardiffcaerdydd, Cities.Swanseaabertawe], cost: 7 },
109
+ { nodes: [Cities.Swanseaabertawe, Cities.Newportcasnewydd], cost: 8 },
110
+ { nodes: [Cities.Newportcasnewydd, Cities.Cardiffcaerdydd], cost: 3 },
111
+ { nodes: [Cities.Bristol, Cities.Southampton], cost: 11 },
112
+ { nodes: [Cities.Southampton, Cities.London2], cost: 9 },
113
+ { nodes: [Cities.London2, Cities.Bristol], cost: 14 },
114
+ { nodes: [Cities.London1, Cities.Newportcasnewydd], cost: 16 },
115
+ { nodes: [Cities.Haverfordwesthwlffordd, Cities.Aberystwyth], cost: 9 },
116
+ { nodes: [Cities.Haverfordwesthwlffordd, Cities.Swanseaabertawe], cost: 8 },
117
+ { nodes: [Cities.Swanseaabertawe, Cities.Aberystwyth], cost: 11 },
118
+ { nodes: [Cities.Aberystwyth, Cities.Bangor], cost: 11 },
119
+ { nodes: [Cities.Bangor, Cities.Liverpool], cost: 9 },
120
+ { nodes: [Cities.Liverpool, Cities.Aberystwyth], cost: 16 },
121
+ { nodes: [Cities.Aberystwyth, Cities.Newportcasnewydd], cost: 14 },
122
+ { nodes: [Cities.Aberystwyth, Cities.Birmingham], cost: 16 },
123
+ { nodes: [Cities.Birmingham, Cities.Liverpool], cost: 12 },
124
+ { nodes: [Cities.Birmingham, Cities.Newportcasnewydd], cost: 9 },
125
+ { nodes: [Cities.London1, Cities.Norwich], cost: 11 },
126
+ { nodes: [Cities.Norwich, Cities.Leicester], cost: 12 },
127
+ { nodes: [Cities.Leicester, Cities.London1], cost: 10 },
128
+ { nodes: [Cities.London1, Cities.Birmingham], cost: 13 },
129
+ { nodes: [Cities.Birmingham, Cities.Leicester], cost: 6 },
130
+ { nodes: [Cities.Birmingham, Cities.Nottingham], cost: 7 },
131
+ { nodes: [Cities.Nottingham, Cities.Sheffield], cost: 6 },
132
+ { nodes: [Cities.Sheffield, Cities.Leeds], cost: 5 },
133
+ { nodes: [Cities.Leeds, Cities.Manchester], cost: 8 },
134
+ { nodes: [Cities.Manchester, Cities.Sheffield], cost: 8 },
135
+ { nodes: [Cities.Sheffield, Cities.Liverpool], cost: 12 },
136
+ { nodes: [Cities.Liverpool, Cities.Nottingham], cost: 15 },
137
+ { nodes: [Cities.Manchester, Cities.Dumfries], cost: 18 },
138
+ { nodes: [Cities.Manchester, Cities.Newcastleupontyne], cost: 15 },
139
+ { nodes: [Cities.Newcastleupontyne, Cities.Dumfries], cost: 12 },
140
+ { nodes: [Cities.Dumfries, Cities.Edinburgh], cost: 12 },
141
+ { nodes: [Cities.Edinburgh, Cities.Newcastleupontyne], cost: 13 },
142
+ { nodes: [Cities.Newcastleupontyne, Cities.Leeds], cost: 13 },
143
+ { nodes: [Cities.Dumfries, Cities.Glasgow], cost: 11 },
144
+ { nodes: [Cities.Glasgow, Cities.Edinburgh], cost: 7 },
145
+ { nodes: [Cities.Glasgow, Cities.Perthpeairt], cost: 10 },
146
+ { nodes: [Cities.Perthpeairt, Cities.Dundeedundeach], cost: 3 },
147
+ { nodes: [Cities.Glasgow, Cities.Invernessinbhirnis], cost: 20 },
148
+ { nodes: [Cities.Invernessinbhirnis, Cities.Perthpeairt], cost: 14 },
149
+ { nodes: [Cities.Invernessinbhirnis, Cities.Dundeedundeach], cost: 14 },
150
+ { nodes: [Cities.Invernessinbhirnis, Cities.Aberdeenobardheathain], cost: 15 },
151
+ { nodes: [Cities.Aberdeenobardheathain, Cities.Dundeedundeach], cost: 10 },
152
+ { nodes: [Cities.Limerick, Cities.Cork], cost: 12 },
153
+ { nodes: [Cities.Cork, Cities.Waterford], cost: 8 },
154
+ { nodes: [Cities.Waterford, Cities.Limerick], cost: 11 },
155
+ { nodes: [Cities.Limerick, Cities.Galway], cost: 10 },
156
+ { nodes: [Cities.Galway, Cities.Sligo], cost: 10 },
157
+ { nodes: [Cities.Sligo, Cities.Derry], cost: 10 },
158
+ { nodes: [Cities.Derry, Cities.Coleraine], cost: 6 },
159
+ { nodes: [Cities.Coleraine, Cities.Belfast], cost: 8 },
160
+ { nodes: [Cities.Belfast, Cities.Newry], cost: 6 },
161
+ { nodes: [Cities.Newry, Cities.Dublin], cost: 10 },
162
+ { nodes: [Cities.Dublin, Cities.Waterford], cost: 13 },
163
+ { nodes: [Cities.Galway, Cities.Athlone], cost: 8 },
164
+ { nodes: [Cities.Athlone, Cities.Sligo], cost: 9 },
165
+ { nodes: [Cities.Athlone, Cities.Limerick], cost: 9 },
166
+ { nodes: [Cities.Limerick, Cities.Dublin], cost: 16 },
167
+ { nodes: [Cities.Dublin, Cities.Athlone], cost: 9 },
168
+ { nodes: [Cities.Athlone, Cities.Newry], cost: 12 },
169
+ { nodes: [Cities.Athlone, Cities.Omagh], cost: 14 },
170
+ { nodes: [Cities.Omagh, Cities.Newry], cost: 8 },
171
+ { nodes: [Cities.Omagh, Cities.Belfast], cost: 10 },
172
+ { nodes: [Cities.Belfast, Cities.Derry], cost: 10 },
173
+ { nodes: [Cities.Omagh, Cities.Derry], cost: 5 },
174
+ { nodes: [Cities.Omagh, Cities.Sligo], cost: 10 },
175
+ ],
176
+ };
@@ -0,0 +1,50 @@
1
+ import seedrandom from 'seedrandom';
2
+ import { PowerPlant } from './gamestate';
3
+ export interface City {
4
+ name: string;
5
+ region: string;
6
+ x: number;
7
+ y: number;
8
+ }
9
+ export interface Connection {
10
+ nodes: string[];
11
+ cost: number;
12
+ }
13
+ export interface Polygon {
14
+ region: string;
15
+ points: number[][];
16
+ }
17
+ export interface GameMap {
18
+ name: string;
19
+ cities: City[];
20
+ connections: Connection[];
21
+ polygons?: Polygon[];
22
+ layout?: 'Portrait' | 'Landscape';
23
+ adjustRatio?: [number, number];
24
+ viewBox?: [number, number];
25
+ playerOrderPosition?: [number, number];
26
+ cityCountPosition?: [number, number];
27
+ powerPlantMarketPosition?: [number, number];
28
+ actualMarketWidth?: number;
29
+ mapPosition?: [number, number];
30
+ buttonsPosition?: [number, number];
31
+ playerBoardsPosition?: [number, number];
32
+ supplyPosition?: [number, number];
33
+ roundInfoPosition?: [number, number];
34
+ resupply?: number[][][];
35
+ startingResources?: number[];
36
+ startingSupply?: number[];
37
+ maxPriceAvailable?: number[];
38
+ coalPrices?: number[];
39
+ oilPrices?: number[];
40
+ garbagePrices?: number[];
41
+ uraniumPrices?: number[];
42
+ setupDeck?: (numPlayers: number, variant: string, rng: seedrandom.prng) => {
43
+ actualMarket: PowerPlant[];
44
+ futureMarket: PowerPlant[];
45
+ powerPlantsDeck: PowerPlant[];
46
+ };
47
+ mapSpecificRules?: string;
48
+ }
49
+ export declare const maps: GameMap[];
50
+ export declare const mapsRecharged: GameMap[];
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapsRecharged = exports.maps = void 0;
4
+ const america_1 = require("./maps/america");
5
+ const benelux_1 = require("./maps/benelux");
6
+ const brazil_1 = require("./maps/brazil");
7
+ const centraleurope_1 = require("./maps/centraleurope");
8
+ const china_1 = require("./maps/china");
9
+ const france_1 = require("./maps/france");
10
+ const germany_1 = require("./maps/germany");
11
+ const indian_1 = require("./maps/indian");
12
+ const italy_1 = require("./maps/italy");
13
+ const middleeast_1 = require("./maps/middleeast");
14
+ const quebec_1 = require("./maps/quebec");
15
+ const russia_1 = require("./maps/russia");
16
+ const spainportugal_1 = require("./maps/spainportugal");
17
+ exports.maps = [
18
+ america_1.map,
19
+ germany_1.map,
20
+ brazil_1.map,
21
+ spainportugal_1.map,
22
+ france_1.map,
23
+ indian_1.map,
24
+ italy_1.map,
25
+ quebec_1.map,
26
+ middleeast_1.map,
27
+ china_1.map,
28
+ benelux_1.map,
29
+ russia_1.map,
30
+ centraleurope_1.map,
31
+ // australia,
32
+ // badenwurttemberg,
33
+ // japan,
34
+ // korea,
35
+ // northerneurope,
36
+ // southafrica,
37
+ // ukireland,
38
+ ];
39
+ exports.mapsRecharged = [
40
+ america_1.mapRecharged,
41
+ germany_1.mapRecharged,
42
+ brazil_1.map,
43
+ spainportugal_1.map,
44
+ france_1.map,
45
+ indian_1.map,
46
+ italy_1.map,
47
+ quebec_1.map,
48
+ middleeast_1.map,
49
+ china_1.map,
50
+ benelux_1.map,
51
+ russia_1.map,
52
+ centraleurope_1.map,
53
+ // australia,
54
+ // badenwurttemberg,
55
+ // china,
56
+ // japan,
57
+ // korea,
58
+ // northerneurope,
59
+ // southafrica,
60
+ // ukireland,
61
+ ];