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,306 @@
1
+ import { cloneDeep } from 'lodash';
2
+ import seedrandom from 'seedrandom';
3
+ import { getPowerPlant } from '../engine';
4
+ import { PowerPlant, PowerPlantType } from '../gamestate';
5
+ import { shuffle } from '../utils';
6
+ import { GameMap } from './../maps';
7
+ import { powerPlants } from './../powerPlants';
8
+
9
+ export enum Regions {
10
+ Red = 'red',
11
+ Pink = 'pink',
12
+ Purple = 'purple',
13
+ Green = 'green',
14
+ Brown = 'brown',
15
+ Yellow = 'yellow',
16
+ }
17
+
18
+ export enum Cities {
19
+ Parnaiba = 'Parnaiba',
20
+ Fortaleza = 'Fortaleza',
21
+ Sadluis = 'Sadluis',
22
+ Belem = 'Belem',
23
+ Teresina = 'Teresina',
24
+ Imperatriz = 'Imperatriz',
25
+ Maraba = 'Maraba',
26
+ Campinagrande = 'Campina Grande',
27
+ Petrolina = 'Petrolina',
28
+ Natal = 'Natal',
29
+ Joaopessoa = 'Joaopessoa',
30
+ Recife = 'Recife',
31
+ Maceio = 'Maceio',
32
+ Aracaju = 'Aracaju',
33
+ Salvadordabahia = 'Salvador Da Bahia',
34
+ Montesclaros = 'Montes Claros',
35
+ Brasilia = 'Brasilia',
36
+ Palmas = 'Palmas',
37
+ Porangatu = 'Porangatu',
38
+ Goiania = 'Goiania',
39
+ Uberlandia = 'Uberlandia',
40
+ Vitoria = 'Vitoria',
41
+ Riodejaneiro = 'Rio De Janeiro',
42
+ Saogoncalo = 'Sao Goncalo',
43
+ Saopaulo = 'Sao Paulo',
44
+ Guarulhos = 'Guarulhos',
45
+ Campinas = 'Campinas',
46
+ Belohorizonte = 'Belo Horizonte',
47
+ Curitiba = 'Curitiba',
48
+ Florianopolis = 'Florianopolis',
49
+ Portoalecre = 'Porto Alecre',
50
+ Pelotas = 'Pelotas',
51
+ Urucuaiana = 'Urucuaiana',
52
+ Londrina = 'Londrina',
53
+ Campogrande = 'Campo Grande',
54
+ Macapa = 'Macapa',
55
+ Boavista = 'Boavista',
56
+ Manaus = 'Manaus',
57
+ Portovelho = 'Porto Velho',
58
+ Cuiaba = 'Cuiaba',
59
+ Vilhena = 'Vilhena',
60
+ Riobranco = 'Rio Branco',
61
+ }
62
+
63
+ export const map: GameMap = {
64
+ name: 'Brazil',
65
+ cities: [
66
+ { name: Cities.Parnaiba, region: Regions.Red, x: 855, y: 458 },
67
+ { name: Cities.Fortaleza, region: Regions.Red, x: 961, y: 478 },
68
+ { name: Cities.Sadluis, region: Regions.Red, x: 772, y: 418 },
69
+ { name: Cities.Belem, region: Regions.Red, x: 655, y: 378 },
70
+ { name: Cities.Teresina, region: Regions.Red, x: 846, y: 548 },
71
+ { name: Cities.Imperatriz, region: Regions.Red, x: 697, y: 535 },
72
+ { name: Cities.Maraba, region: Regions.Red, x: 581, y: 492 },
73
+ { name: Cities.Campinagrande, region: Regions.Pink, x: 976, y: 587 },
74
+ { name: Cities.Petrolina, region: Regions.Pink, x: 872, y: 648 },
75
+ { name: Cities.Natal, region: Regions.Pink, x: 1061, y: 518 },
76
+ { name: Cities.Joaopessoa, region: Regions.Pink, x: 1097, y: 576 },
77
+ { name: Cities.Recife, region: Regions.Pink, x: 1083, y: 637 },
78
+ { name: Cities.Maceio, region: Regions.Pink, x: 1040, y: 699 },
79
+ { name: Cities.Aracaju, region: Regions.Pink, x: 995, y: 750 },
80
+ { name: Cities.Salvadordabahia, region: Regions.Purple, x: 960, y: 808 },
81
+ { name: Cities.Montesclaros, region: Regions.Purple, x: 795, y: 847 },
82
+ { name: Cities.Brasilia, region: Regions.Purple, x: 671, y: 817 },
83
+ { name: Cities.Palmas, region: Regions.Purple, x: 648, y: 663 },
84
+ { name: Cities.Porangatu, region: Regions.Purple, x: 598, y: 762 },
85
+ { name: Cities.Goiania, region: Regions.Purple, x: 601, y: 889 },
86
+ { name: Cities.Uberlandia, region: Regions.Purple, x: 646, y: 964 },
87
+ { name: Cities.Vitoria, region: Regions.Green, x: 910, y: 971 },
88
+ { name: Cities.Riodejaneiro, region: Regions.Green, x: 795, y: 1076 },
89
+ { name: Cities.Saogoncalo, region: Regions.Green, x: 843, y: 1033 },
90
+ { name: Cities.Saopaulo, region: Regions.Green, x: 721, y: 1134 },
91
+ { name: Cities.Guarulhos, region: Regions.Green, x: 678, y: 1089 },
92
+ { name: Cities.Campinas, region: Regions.Green, x: 629, y: 1037 },
93
+ { name: Cities.Belohorizonte, region: Regions.Green, x: 771, y: 960 },
94
+ { name: Cities.Curitiba, region: Regions.Brown, x: 615, y: 1144 },
95
+ { name: Cities.Florianopolis, region: Regions.Brown, x: 665, y: 1214 },
96
+ { name: Cities.Portoalecre, region: Regions.Brown, x: 590, y: 1281 },
97
+ { name: Cities.Pelotas, region: Regions.Brown, x: 551, y: 1346 },
98
+ { name: Cities.Urucuaiana, region: Regions.Brown, x: 444, y: 1250 },
99
+ { name: Cities.Londrina, region: Regions.Brown, x: 516, y: 1075 },
100
+ { name: Cities.Campogrande, region: Regions.Brown, x: 440, y: 983 },
101
+ { name: Cities.Macapa, region: Regions.Yellow, x: 561, y: 317 },
102
+ { name: Cities.Boavista, region: Regions.Yellow, x: 308, y: 269 },
103
+ { name: Cities.Manaus, region: Regions.Yellow, x: 258, y: 466 },
104
+ { name: Cities.Portovelho, region: Regions.Yellow, x: 238, y: 620 },
105
+ { name: Cities.Cuiaba, region: Regions.Yellow, x: 432, y: 850 },
106
+ { name: Cities.Vilhena, region: Regions.Yellow, x: 328, y: 741 },
107
+ { name: Cities.Riobranco, region: Regions.Yellow, x: 87, y: 666 },
108
+ ],
109
+ connections: [
110
+ { nodes: [Cities.Boavista, Cities.Macapa], cost: 22 },
111
+ { nodes: [Cities.Macapa, Cities.Belem], cost: 10 },
112
+ { nodes: [Cities.Belem, Cities.Sadluis], cost: 10 },
113
+ { nodes: [Cities.Sadluis, Cities.Imperatriz], cost: 9 },
114
+ { nodes: [Cities.Belem, Cities.Imperatriz], cost: 9 },
115
+ { nodes: [Cities.Belem, Cities.Maraba], cost: 9 },
116
+ { nodes: [Cities.Macapa, Cities.Maraba], cost: 16 },
117
+ { nodes: [Cities.Maraba, Cities.Manaus], cost: 22 },
118
+ { nodes: [Cities.Macapa, Cities.Manaus], cost: 18 },
119
+ { nodes: [Cities.Boavista, Cities.Manaus], cost: 13 },
120
+ { nodes: [Cities.Boavista, Cities.Riobranco], cost: 30 },
121
+ { nodes: [Cities.Riobranco, Cities.Manaus], cost: 23 },
122
+ { nodes: [Cities.Manaus, Cities.Portovelho], cost: 15 },
123
+ { nodes: [Cities.Portovelho, Cities.Riobranco], cost: 10 },
124
+ { nodes: [Cities.Riobranco, Cities.Vilhena], cost: 18 },
125
+ { nodes: [Cities.Portovelho, Cities.Vilhena], cost: 12 },
126
+ { nodes: [Cities.Manaus, Cities.Vilhena], cost: 21 },
127
+ { nodes: [Cities.Vilhena, Cities.Cuiaba], cost: 10 },
128
+ { nodes: [Cities.Vilhena, Cities.Maraba], cost: 31 },
129
+ { nodes: [Cities.Maraba, Cities.Imperatriz], cost: 4 },
130
+ { nodes: [Cities.Sadluis, Cities.Teresina], cost: 8 },
131
+ { nodes: [Cities.Teresina, Cities.Imperatriz], cost: 11 },
132
+ { nodes: [Cities.Imperatriz, Cities.Palmas], cost: 9 },
133
+ { nodes: [Cities.Palmas, Cities.Maraba], cost: 10 },
134
+ { nodes: [Cities.Maraba, Cities.Porangatu], cost: 17 },
135
+ { nodes: [Cities.Porangatu, Cities.Goiania], cost: 8 },
136
+ { nodes: [Cities.Porangatu, Cities.Vilhena], cost: 23 },
137
+ { nodes: [Cities.Cuiaba, Cities.Porangatu], cost: 16 },
138
+ { nodes: [Cities.Porangatu, Cities.Palmas], cost: 8 },
139
+ { nodes: [Cities.Palmas, Cities.Brasilia], cost: 13 },
140
+ { nodes: [Cities.Brasilia, Cities.Porangatu], cost: 6 },
141
+ { nodes: [Cities.Brasilia, Cities.Goiania], cost: 4 },
142
+ { nodes: [Cities.Goiania, Cities.Cuiaba], cost: 15 },
143
+ { nodes: [Cities.Sadluis, Cities.Parnaiba], cost: 5 },
144
+ { nodes: [Cities.Parnaiba, Cities.Teresina], cost: 5 },
145
+ { nodes: [Cities.Parnaiba, Cities.Fortaleza], cost: 7 },
146
+ { nodes: [Cities.Fortaleza, Cities.Natal], cost: 8 },
147
+ { nodes: [Cities.Natal, Cities.Joaopessoa], cost: 3 },
148
+ { nodes: [Cities.Joaopessoa, Cities.Recife], cost: 2 },
149
+ { nodes: [Cities.Recife, Cities.Maceio], cost: 3 },
150
+ { nodes: [Cities.Maceio, Cities.Aracaju], cost: 3 },
151
+ { nodes: [Cities.Aracaju, Cities.Salvadordabahia], cost: 4 },
152
+ { nodes: [Cities.Natal, Cities.Campinagrande], cost: 4 },
153
+ { nodes: [Cities.Fortaleza, Cities.Teresina], cost: 10 },
154
+ { nodes: [Cities.Teresina, Cities.Petrolina], cost: 12 },
155
+ { nodes: [Cities.Petrolina, Cities.Palmas], cost: 19 },
156
+ { nodes: [Cities.Petrolina, Cities.Brasilia], cost: 22 },
157
+ { nodes: [Cities.Petrolina, Cities.Montesclaros], cost: 19 },
158
+ { nodes: [Cities.Montesclaros, Cities.Salvadordabahia], cost: 16 },
159
+ { nodes: [Cities.Salvadordabahia, Cities.Petrolina], cost: 10 },
160
+ { nodes: [Cities.Petrolina, Cities.Campinagrande], cost: 12 },
161
+ { nodes: [Cities.Petrolina, Cities.Aracaju], cost: 11 },
162
+ { nodes: [Cities.Vitoria, Cities.Salvadordabahia], cost: 16 },
163
+ { nodes: [Cities.Montesclaros, Cities.Vitoria], cost: 14 },
164
+ { nodes: [Cities.Vitoria, Cities.Saogoncalo], cost: 6 },
165
+ { nodes: [Cities.Vitoria, Cities.Belohorizonte], cost: 9 },
166
+ { nodes: [Cities.Belohorizonte, Cities.Montesclaros], cost: 8 },
167
+ { nodes: [Cities.Montesclaros, Cities.Brasilia], cost: 9 },
168
+ { nodes: [Cities.Brasilia, Cities.Uberlandia], cost: 8 },
169
+ { nodes: [Cities.Uberlandia, Cities.Goiania], cost: 7 },
170
+ { nodes: [Cities.Goiania, Cities.Campogrande], cost: 16 },
171
+ { nodes: [Cities.Campogrande, Cities.Cuiaba], cost: 13 },
172
+ { nodes: [Cities.Campogrande, Cities.Londrina], cost: 10 },
173
+ { nodes: [Cities.Campogrande, Cities.Uberlandia], cost: 13 },
174
+ { nodes: [Cities.Uberlandia, Cities.Londrina], cost: 12 },
175
+ { nodes: [Cities.Londrina, Cities.Campinas], cost: 9 },
176
+ { nodes: [Cities.Campinas, Cities.Uberlandia], cost: 9 },
177
+ { nodes: [Cities.Uberlandia, Cities.Belohorizonte], cost: 10 },
178
+ { nodes: [Cities.Uberlandia, Cities.Brasilia], cost: 8 },
179
+ { nodes: [Cities.Brasilia, Cities.Belohorizonte], cost: 14 },
180
+ { nodes: [Cities.Belohorizonte, Cities.Saogoncalo], cost: 7 },
181
+ { nodes: [Cities.Saogoncalo, Cities.Riodejaneiro], cost: 0 },
182
+ { nodes: [Cities.Riodejaneiro, Cities.Saopaulo], cost: 7 },
183
+ { nodes: [Cities.Saopaulo, Cities.Guarulhos], cost: 0 },
184
+ { nodes: [Cities.Guarulhos, Cities.Campinas], cost: 0 },
185
+ { nodes: [Cities.Campinas, Cities.Curitiba], cost: 6 },
186
+ { nodes: [Cities.Curitiba, Cities.Londrina], cost: 7 },
187
+ { nodes: [Cities.Saopaulo, Cities.Florianopolis], cost: 9 },
188
+ { nodes: [Cities.Florianopolis, Cities.Curitiba], cost: 4 },
189
+ { nodes: [Cities.Londrina, Cities.Urucuaiana], cost: 18 },
190
+ { nodes: [Cities.Urucuaiana, Cities.Pelotas], cost: 9 },
191
+ { nodes: [Cities.Pelotas, Cities.Portoalecre], cost: 4 },
192
+ { nodes: [Cities.Portoalecre, Cities.Urucuaiana], cost: 10 },
193
+ { nodes: [Cities.Londrina, Cities.Portoalecre], cost: 16 },
194
+ { nodes: [Cities.Portoalecre, Cities.Curitiba], cost: 11 },
195
+ { nodes: [Cities.Portoalecre, Cities.Florianopolis], cost: 7 },
196
+ { nodes: [Cities.Guarulhos, Cities.Belohorizonte], cost: 10 },
197
+ { nodes: [Cities.Maceio, Cities.Campinagrande], cost: 6 },
198
+ { nodes: [Cities.Petrolina, Cities.Fortaleza], cost: 14 },
199
+ { nodes: [Cities.Recife, Cities.Campinagrande], cost: 3 },
200
+ ],
201
+ layout: 'Portrait',
202
+ adjustRatio: [0.85, 0.85],
203
+ mapPosition: [-20, -130],
204
+ resupply: [
205
+ [
206
+ [1, 2, 3],
207
+ [1, 2, 3],
208
+ [2, 3, 4],
209
+ [3, 3, 5],
210
+ [3, 5, 6],
211
+ ],
212
+ [
213
+ [3, 4, 3],
214
+ [4, 5, 3],
215
+ [5, 6, 4],
216
+ [5, 7, 5],
217
+ [7, 9, 6],
218
+ ],
219
+ [
220
+ [2, 2, 4],
221
+ [2, 3, 4],
222
+ [3, 4, 5],
223
+ [4, 5, 6],
224
+ [5, 6, 7],
225
+ ],
226
+ [
227
+ [1, 1, 1],
228
+ [1, 1, 1],
229
+ [1, 2, 2],
230
+ [2, 3, 2],
231
+ [2, 3, 3],
232
+ ],
233
+ ],
234
+ startingResources: [24, 18, 6, 2],
235
+ setupDeck(numPlayers: number, variant: string, rng: seedrandom.prng) {
236
+ let powerPlantsDeck = cloneDeep(powerPlants);
237
+ let actualMarket: PowerPlant[];
238
+ let futureMarket: PowerPlant[];
239
+
240
+ // remove garbage power plants
241
+ const garbagePlants = powerPlantsDeck.filter((pp) => pp.type == PowerPlantType.Garbage && pp.number > 14);
242
+
243
+ if (variant == 'original') {
244
+ powerPlantsDeck = powerPlantsDeck.slice(8);
245
+ const powerPlant13 = powerPlantsDeck.splice(2, 1)[0];
246
+ const powerPlant14 = powerPlantsDeck.splice(2, 1)[0];
247
+ const step3 = powerPlantsDeck.pop()!;
248
+
249
+ powerPlantsDeck = shuffle(
250
+ powerPlantsDeck.filter((pp) => pp.type != PowerPlantType.Garbage),
251
+ rng() + ''
252
+ );
253
+ if (numPlayers == 2 || numPlayers == 3) {
254
+ powerPlantsDeck = powerPlantsDeck.slice(8);
255
+ } else if (numPlayers == 4) {
256
+ powerPlantsDeck = powerPlantsDeck.slice(4);
257
+ }
258
+
259
+ powerPlantsDeck = powerPlantsDeck.concat(garbagePlants);
260
+ powerPlantsDeck = shuffle(powerPlantsDeck, rng() + '');
261
+
262
+ powerPlantsDeck.unshift(powerPlant14);
263
+ powerPlantsDeck.unshift(powerPlant13);
264
+ powerPlantsDeck.push(step3);
265
+
266
+ actualMarket = [getPowerPlant(3), getPowerPlant(4), getPowerPlant(5), getPowerPlant(6)];
267
+ futureMarket = [getPowerPlant(7), getPowerPlant(8), getPowerPlant(9), getPowerPlant(10)];
268
+ } else {
269
+ const powerPlant6 = powerPlantsDeck.splice(3, 1)[0];
270
+ const powerPlant14 = powerPlantsDeck.splice(10, 1)[0];
271
+
272
+ let initialPowerPlants = shuffle(powerPlantsDeck.splice(0, 11), rng() + '');
273
+ let initialPlantMarket = initialPowerPlants.splice(0, 6);
274
+ initialPlantMarket.push(powerPlant6, powerPlant14);
275
+ initialPlantMarket = initialPlantMarket.sort((a, b) => a.number - b.number);
276
+ actualMarket = initialPlantMarket.slice(0, 4);
277
+ futureMarket = initialPlantMarket.slice(4);
278
+
279
+ const first = initialPowerPlants.shift()!;
280
+ const step3 = powerPlantsDeck.pop()!;
281
+
282
+ powerPlantsDeck = shuffle(
283
+ powerPlantsDeck.filter((pp) => pp.type != PowerPlantType.Garbage),
284
+ rng() + ''
285
+ );
286
+ if (numPlayers == 2 || numPlayers == 3) {
287
+ initialPowerPlants = initialPowerPlants.slice(2);
288
+ powerPlantsDeck = shuffle(powerPlantsDeck.slice(6).concat(initialPowerPlants), rng() + '');
289
+ } else if (numPlayers == 4) {
290
+ initialPowerPlants = initialPowerPlants.slice(1);
291
+ powerPlantsDeck = shuffle(powerPlantsDeck.slice(3).concat(initialPowerPlants), rng() + '');
292
+ } else {
293
+ powerPlantsDeck = shuffle(powerPlantsDeck.concat(initialPowerPlants), rng() + '');
294
+ }
295
+
296
+ powerPlantsDeck = powerPlantsDeck.concat(garbagePlants);
297
+ powerPlantsDeck = shuffle(powerPlantsDeck, rng() + '');
298
+
299
+ powerPlantsDeck.unshift(first);
300
+ powerPlantsDeck.push(step3);
301
+ }
302
+
303
+ return { actualMarket, futureMarket, powerPlantsDeck };
304
+ },
305
+ mapSpecificRules: 'Play with all garbage power plants.',
306
+ };
@@ -0,0 +1,235 @@
1
+ import { GameMap } from './../maps';
2
+
3
+ export enum Regions {
4
+ Blue = 'blue',
5
+ Brown = 'brown',
6
+ Purple = 'purple',
7
+ Red = 'red',
8
+ Yellow = 'yellow',
9
+ Green = 'green',
10
+ }
11
+
12
+ export enum Cities {
13
+ Bialystok = 'Bialystok',
14
+ Lublin = 'Lublin',
15
+ Warszawa = 'Warszawa',
16
+ Krakow = 'Krakow',
17
+ Sosnowiec = 'Sosnowiec',
18
+ Katowice = 'Katowice',
19
+ Czestochowa = 'Czesto Chowa',
20
+ Presov = 'Presov',
21
+ Kosice = 'Kosice',
22
+ Poprad = 'Poprad',
23
+ Zilina = 'Zilina',
24
+ Bratislava = 'Bratislava',
25
+ Trnava = 'Trnava',
26
+ Nyiregyhaza = 'Nyiregyhaza',
27
+ Miskolc = 'Miskolc',
28
+ Szeged = 'Szeged',
29
+ Kecskeme = 'Kecskeme',
30
+ Budapest = 'Budapest',
31
+ Pecs = 'Pecs',
32
+ Gyor = 'Gyor',
33
+ Banskabystrica = 'Banska Bystrica',
34
+ Goansk = 'Goansk',
35
+ Goynia = 'Goynia',
36
+ Byogoszcz = 'Byogoszcz',
37
+ Wroclaw = 'Wroclaw',
38
+ Poznan = 'Poznan',
39
+ Szczecin = 'Szczecin',
40
+ Lodz = 'Lodz',
41
+ Graz = 'Graz',
42
+ Klagenfurt = 'Klagenfurt',
43
+ Villach = 'Villach',
44
+ Innsbruck = 'Innsbruck',
45
+ Salzburg = 'Salzburg',
46
+ Linz = 'Linz',
47
+ Wien = 'Wien',
48
+ Hradeckralove = 'Hradec Kralove',
49
+ Brno = 'Brno',
50
+ Ceskebudejovice = 'Ceske Budejovice',
51
+ Praha = 'Praha',
52
+ Ostrava = 'Ostrava',
53
+ Plzen = 'Plzen',
54
+ Ustinadlaben = 'Ustinad Laben',
55
+ }
56
+
57
+ export const map: GameMap = {
58
+ name: 'Central Europe',
59
+ cities: [
60
+ { name: Cities.Bialystok, region: Regions.Blue, x: 543, y: 135 },
61
+ { name: Cities.Lublin, region: Regions.Blue, x: 590, y: 294 },
62
+ { name: Cities.Warszawa, region: Regions.Blue, x: 482, y: 253 },
63
+ { name: Cities.Krakow, region: Regions.Blue, x: 533, y: 443 },
64
+ { name: Cities.Sosnowiec, region: Regions.Blue, x: 468, y: 443 },
65
+ { name: Cities.Katowice, region: Regions.Blue, x: 446, y: 483 },
66
+ { name: Cities.Czestochowa, region: Regions.Blue, x: 419, y: 397 },
67
+ { name: Cities.Presov, region: Regions.Brown, x: 619, y: 487 },
68
+ { name: Cities.Kosice, region: Regions.Brown, x: 646, y: 538 },
69
+ { name: Cities.Poprad, region: Regions.Brown, x: 565, y: 529 },
70
+ { name: Cities.Zilina, region: Regions.Brown, x: 476, y: 551 },
71
+ { name: Cities.Bratislava, region: Regions.Brown, x: 423, y: 693 },
72
+ { name: Cities.Trnava, region: Regions.Brown, x: 452, y: 638 },
73
+ { name: Cities.Nyiregyhaza, region: Regions.Purple, x: 698, y: 582 },
74
+ { name: Cities.Miskolc, region: Regions.Purple, x: 621, y: 597 },
75
+ { name: Cities.Szeged, region: Regions.Purple, x: 680, y: 764 },
76
+ { name: Cities.Kecskeme, region: Regions.Purple, x: 630, y: 727 },
77
+ { name: Cities.Budapest, region: Regions.Purple, x: 557, y: 689 },
78
+ { name: Cities.Pecs, region: Regions.Purple, x: 566, y: 832 },
79
+ { name: Cities.Gyor, region: Regions.Purple, x: 489, y: 729 },
80
+ { name: Cities.Banskabystrica, region: Regions.Brown, x: 525, y: 601 },
81
+ { name: Cities.Goansk, region: Regions.Red, x: 286, y: 158 },
82
+ { name: Cities.Goynia, region: Regions.Red, x: 249, y: 131 },
83
+ { name: Cities.Byogoszcz, region: Regions.Red, x: 297, y: 257 },
84
+ { name: Cities.Wroclaw, region: Regions.Red, x: 321, y: 445 },
85
+ { name: Cities.Poznan, region: Regions.Red, x: 261, y: 342 },
86
+ { name: Cities.Szczecin, region: Regions.Red, x: 110, y: 316 },
87
+ { name: Cities.Lodz, region: Regions.Red, x: 420, y: 337 },
88
+ { name: Cities.Graz, region: Regions.Yellow, x: 376, y: 811 },
89
+ { name: Cities.Klagenfurt, region: Regions.Yellow, x: 340, y: 875 },
90
+ { name: Cities.Villach, region: Regions.Yellow, x: 272, y: 875 },
91
+ { name: Cities.Innsbruck, region: Regions.Yellow, x: 140, y: 879 },
92
+ { name: Cities.Salzburg, region: Regions.Yellow, x: 209, y: 805 },
93
+ { name: Cities.Linz, region: Regions.Yellow, x: 265, y: 744 },
94
+ { name: Cities.Wien, region: Regions.Yellow, x: 366, y: 701 },
95
+ { name: Cities.Hradeckralove, region: Regions.Green, x: 291, y: 546 },
96
+ { name: Cities.Brno, region: Regions.Green, x: 354, y: 597 },
97
+ { name: Cities.Ceskebudejovice, region: Regions.Green, x: 248, y: 670 },
98
+ { name: Cities.Praha, region: Regions.Green, x: 220, y: 593 },
99
+ { name: Cities.Ostrava, region: Regions.Green, x: 413, y: 535 },
100
+ { name: Cities.Plzen, region: Regions.Green, x: 158, y: 645 },
101
+ { name: Cities.Ustinadlaben, region: Regions.Green, x: 165, y: 537 },
102
+ ],
103
+ connections: [
104
+ { nodes: [Cities.Goynia, Cities.Goansk], cost: 0 },
105
+ { nodes: [Cities.Goansk, Cities.Byogoszcz], cost: 8 },
106
+ { nodes: [Cities.Goynia, Cities.Szczecin], cost: 17 },
107
+ { nodes: [Cities.Szczecin, Cities.Poznan], cost: 14 },
108
+ { nodes: [Cities.Szczecin, Cities.Wroclaw], cost: 22 },
109
+ { nodes: [Cities.Wroclaw, Cities.Poznan], cost: 9 },
110
+ { nodes: [Cities.Poznan, Cities.Lodz], cost: 13 },
111
+ { nodes: [Cities.Lodz, Cities.Byogoszcz], cost: 12 },
112
+ { nodes: [Cities.Byogoszcz, Cities.Szczecin], cost: 15 },
113
+ { nodes: [Cities.Wroclaw, Cities.Lodz], cost: 12 },
114
+ { nodes: [Cities.Lodz, Cities.Czestochowa], cost: 7 },
115
+ { nodes: [Cities.Czestochowa, Cities.Wroclaw], cost: 9 },
116
+ { nodes: [Cities.Wroclaw, Cities.Ostrava], cost: 11 },
117
+ { nodes: [Cities.Ostrava, Cities.Hradeckralove], cost: 16 },
118
+ { nodes: [Cities.Hradeckralove, Cities.Wroclaw], cost: 10 },
119
+ { nodes: [Cities.Wroclaw, Cities.Ustinadlaben], cost: 17 },
120
+ { nodes: [Cities.Ustinadlaben, Cities.Hradeckralove], cost: 10 },
121
+ { nodes: [Cities.Hradeckralove, Cities.Brno], cost: 9 },
122
+ { nodes: [Cities.Brno, Cities.Ostrava], cost: 12 },
123
+ { nodes: [Cities.Ostrava, Cities.Katowice], cost: 4 },
124
+ { nodes: [Cities.Czestochowa, Cities.Lublin], cost: 17 },
125
+ { nodes: [Cities.Lublin, Cities.Presov], cost: 20 },
126
+ { nodes: [Cities.Presov, Cities.Krakow], cost: 13 },
127
+ { nodes: [Cities.Krakow, Cities.Poprad], cost: 11 },
128
+ { nodes: [Cities.Poprad, Cities.Zilina], cost: 11 },
129
+ { nodes: [Cities.Zilina, Cities.Krakow], cost: 12 },
130
+ { nodes: [Cities.Krakow, Cities.Sosnowiec], cost: 4 },
131
+ { nodes: [Cities.Warszawa, Cities.Bialystok], cost: 14 },
132
+ { nodes: [Cities.Bialystok, Cities.Goansk], cost: 20 },
133
+ { nodes: [Cities.Byogoszcz, Cities.Warszawa], cost: 15 },
134
+ { nodes: [Cities.Warszawa, Cities.Lublin], cost: 10 },
135
+ { nodes: [Cities.Lodz, Cities.Warszawa], cost: 7 },
136
+ { nodes: [Cities.Bialystok, Cities.Lublin], cost: 15 },
137
+ { nodes: [Cities.Lublin, Cities.Krakow], cost: 16 },
138
+ { nodes: [Cities.Poprad, Cities.Kosice], cost: 6 },
139
+ { nodes: [Cities.Kosice, Cities.Nyiregyhaza], cost: 8 },
140
+ { nodes: [Cities.Kosice, Cities.Miskolc], cost: 4 },
141
+ { nodes: [Cities.Miskolc, Cities.Poprad], cost: 9 },
142
+ { nodes: [Cities.Poprad, Cities.Banskabystrica], cost: 11 },
143
+ { nodes: [Cities.Banskabystrica, Cities.Zilina], cost: 6 },
144
+ { nodes: [Cities.Zilina, Cities.Trnava], cost: 10 },
145
+ { nodes: [Cities.Zilina, Cities.Brno], cost: 14 },
146
+ { nodes: [Cities.Brno, Cities.Wien], cost: 8 },
147
+ { nodes: [Cities.Bratislava, Cities.Brno], cost: 10 },
148
+ { nodes: [Cities.Brno, Cities.Trnava], cost: 10 },
149
+ { nodes: [Cities.Trnava, Cities.Banskabystrica], cost: 10 },
150
+ { nodes: [Cities.Banskabystrica, Cities.Miskolc], cost: 11 },
151
+ { nodes: [Cities.Miskolc, Cities.Nyiregyhaza], cost: 7 },
152
+ { nodes: [Cities.Nyiregyhaza, Cities.Szeged], cost: 16 },
153
+ { nodes: [Cities.Szeged, Cities.Kecskeme], cost: 5 },
154
+ { nodes: [Cities.Budapest, Cities.Trnava], cost: 9 },
155
+ { nodes: [Cities.Trnava, Cities.Bratislava], cost: 2 },
156
+ { nodes: [Cities.Bratislava, Cities.Wien], cost: 3 },
157
+ { nodes: [Cities.Wien, Cities.Ceskebudejovice], cost: 14 },
158
+ { nodes: [Cities.Ceskebudejovice, Cities.Praha], cost: 10 },
159
+ { nodes: [Cities.Praha, Cities.Brno], cost: 13 },
160
+ { nodes: [Cities.Brno, Cities.Ceskebudejovice], cost: 15 },
161
+ { nodes: [Cities.Ceskebudejovice, Cities.Plzen], cost: 11 },
162
+ { nodes: [Cities.Plzen, Cities.Praha], cost: 7 },
163
+ { nodes: [Cities.Praha, Cities.Ustinadlaben], cost: 6 },
164
+ { nodes: [Cities.Ustinadlaben, Cities.Plzen], cost: 9 },
165
+ { nodes: [Cities.Ceskebudejovice, Cities.Linz], cost: 8 },
166
+ { nodes: [Cities.Linz, Cities.Wien], cost: 11 },
167
+ { nodes: [Cities.Wien, Cities.Graz], cost: 12 },
168
+ { nodes: [Cities.Graz, Cities.Linz], cost: 16 },
169
+ { nodes: [Cities.Linz, Cities.Salzburg], cost: 9 },
170
+ { nodes: [Cities.Salzburg, Cities.Graz], cost: 22 },
171
+ { nodes: [Cities.Graz, Cities.Gyor], cost: 14 },
172
+ { nodes: [Cities.Gyor, Cities.Wien], cost: 8 },
173
+ { nodes: [Cities.Bratislava, Cities.Gyor], cost: 6 },
174
+ { nodes: [Cities.Gyor, Cities.Trnava], cost: 5 },
175
+ { nodes: [Cities.Banskabystrica, Cities.Budapest], cost: 12 },
176
+ { nodes: [Cities.Budapest, Cities.Gyor], cost: 5 },
177
+ { nodes: [Cities.Budapest, Cities.Kecskeme], cost: 6 },
178
+ { nodes: [Cities.Kecskeme, Cities.Miskolc], cost: 10 },
179
+ { nodes: [Cities.Miskolc, Cities.Budapest], cost: 9 },
180
+ { nodes: [Cities.Szeged, Cities.Pecs], cost: 12 },
181
+ { nodes: [Cities.Pecs, Cities.Kecskeme], cost: 11 },
182
+ { nodes: [Cities.Budapest, Cities.Pecs], cost: 12 },
183
+ { nodes: [Cities.Pecs, Cities.Gyor], cost: 15 },
184
+ { nodes: [Cities.Graz, Cities.Pecs], cost: 19 },
185
+ { nodes: [Cities.Graz, Cities.Klagenfurt], cost: 10 },
186
+ { nodes: [Cities.Klagenfurt, Cities.Villach], cost: 4 },
187
+ { nodes: [Cities.Klagenfurt, Cities.Salzburg], cost: 20 },
188
+ { nodes: [Cities.Salzburg, Cities.Innsbruck], cost: 15 },
189
+ { nodes: [Cities.Innsbruck, Cities.Villach], cost: 22 },
190
+ { nodes: [Cities.Poznan, Cities.Byogoszcz], cost: 7 },
191
+ { nodes: [Cities.Lublin, Cities.Lodz], cost: 16 },
192
+ { nodes: [Cities.Czestochowa, Cities.Sosnowiec], cost: 4 },
193
+ { nodes: [Cities.Sosnowiec, Cities.Katowice], cost: 0 },
194
+ { nodes: [Cities.Czestochowa, Cities.Krakow], cost: 6 },
195
+ { nodes: [Cities.Poprad, Cities.Presov], cost: 7 },
196
+ { nodes: [Cities.Presov, Cities.Kosice], cost: 2 },
197
+ { nodes: [Cities.Ostrava, Cities.Zilina], cost: 7 },
198
+ { nodes: [Cities.Ostrava, Cities.Krakow], cost: 7 },
199
+ { nodes: [Cities.Praha, Cities.Hradeckralove], cost: 8 },
200
+ ],
201
+ layout: 'Portrait',
202
+ mapPosition: [70, -60],
203
+ adjustRatio: [1.15, 1.15],
204
+ startingResources: [24, 18, 6, 5],
205
+ resupply: [
206
+ [
207
+ [4, 5, 3],
208
+ [5, 6, 3],
209
+ [6, 7, 5],
210
+ [7, 8, 5],
211
+ [8, 10, 6],
212
+ ],
213
+ [
214
+ [1, 2, 3],
215
+ [2, 2, 3],
216
+ [2, 3, 4],
217
+ [3, 4, 5],
218
+ [4, 5, 6],
219
+ ],
220
+ [
221
+ [1, 3, 3],
222
+ [1, 3, 3],
223
+ [2, 4, 4],
224
+ [3, 4, 5],
225
+ [3, 6, 6],
226
+ ],
227
+ [
228
+ [1, 1, 1],
229
+ [1, 1, 1],
230
+ [1, 2, 1],
231
+ [2, 2, 2],
232
+ [2, 3, 2],
233
+ ],
234
+ ],
235
+ };