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,268 @@
1
+ import { cloneDeep } from 'lodash';
2
+ import { PowerPlant, PowerPlantType } from '../gamestate';
3
+ import { powerPlants } from '../powerPlants';
4
+ import { shuffle } from '../utils';
5
+ import { GameMap } from './../maps';
6
+
7
+ export enum Regions {
8
+ Pink = 'pink',
9
+ Green = 'green',
10
+ Red = 'red',
11
+ Brown = 'brown',
12
+ Purple = 'purple',
13
+ Yellow = 'yellow',
14
+ }
15
+
16
+ export enum Cities {
17
+ Hegang = 'Hegang',
18
+ Qiqhaer = 'Qiqhaer',
19
+ Haerbin = 'Haerbin',
20
+ Jilin = 'Jilin',
21
+ Fushun = 'Fushun',
22
+ Anshan = 'Anshan',
23
+ Dalian = 'Dalian',
24
+ Shanghai = 'Shanghai',
25
+ Hangzhou = 'Hangzhou',
26
+ Nanjing = 'Nanjing',
27
+ Qingoad = 'Qingoad',
28
+ Jinan = 'Jinan',
29
+ Zhengzhou = 'Zhengzhou',
30
+ Shijiazhuang = 'Shijiazhuang',
31
+ Changchun = 'Changchun',
32
+ Shenyang = 'Shenyang',
33
+ Tangshan = 'Tangshan',
34
+ Tianjin = 'Tianjin',
35
+ Beijing = 'Beijing',
36
+ Taiyuan = 'Taiyuan',
37
+ Badtou = 'Badtou',
38
+ Fuzhou = 'Fuzhou',
39
+ Nanchang = 'Nanchang',
40
+ Chaozhou = 'Chaozhou',
41
+ Hongkong = 'Hong Kong',
42
+ Guangzhou = 'Guangzhou',
43
+ Changsha = 'Changsha',
44
+ Wuhan = 'Wuhan',
45
+ Hami = 'Hami',
46
+ Karamay = 'Karamay',
47
+ Wulumuqi = 'Wulumuqi',
48
+ Kuerle = 'Kuerle',
49
+ Yinchjan = 'Yinchjan',
50
+ Xining = 'Xining',
51
+ Lanzhou = 'Lanzhou',
52
+ Kunming = 'Kunming',
53
+ Chengou = 'Chengou',
54
+ Xian = 'Xian',
55
+ Chongqing = 'Chongqing',
56
+ Nanning = 'Nanning',
57
+ Haikou = 'Haikou',
58
+ Chiyang = 'Chiyang',
59
+ }
60
+
61
+ export const map: GameMap = {
62
+ name: 'China',
63
+ cities: [
64
+ { name: Cities.Hegang, region: Regions.Pink, x: 3920, y: 290 },
65
+ { name: Cities.Qiqhaer, region: Regions.Pink, x: 3422, y: 262 },
66
+ { name: Cities.Haerbin, region: Regions.Pink, x: 3672, y: 434 },
67
+ { name: Cities.Jilin, region: Regions.Pink, x: 3744, y: 614 },
68
+ { name: Cities.Fushun, region: Regions.Pink, x: 3712, y: 784 },
69
+ { name: Cities.Anshan, region: Regions.Pink, x: 3510, y: 902 },
70
+ { name: Cities.Dalian, region: Regions.Pink, x: 3424, y: 1052 },
71
+ { name: Cities.Shanghai, region: Regions.Green, x: 3462, y: 1672 },
72
+ { name: Cities.Hangzhou, region: Regions.Green, x: 3280, y: 1824 },
73
+ { name: Cities.Nanjing, region: Regions.Green, x: 3130, y: 1632 },
74
+ { name: Cities.Qingoad, region: Regions.Green, x: 3322, y: 1316 },
75
+ { name: Cities.Jinan, region: Regions.Green, x: 3002, y: 1292 },
76
+ { name: Cities.Zhengzhou, region: Regions.Green, x: 2778, y: 1438 },
77
+ { name: Cities.Shijiazhuang, region: Regions.Green, x: 2866, y: 1152 },
78
+ { name: Cities.Changchun, region: Regions.Red, x: 3504, y: 590 },
79
+ { name: Cities.Shenyang, region: Regions.Red, x: 3458, y: 778 },
80
+ { name: Cities.Tangshan, region: Regions.Red, x: 3158, y: 908 },
81
+ { name: Cities.Tianjin, region: Regions.Red, x: 3134, y: 1016 },
82
+ { name: Cities.Beijing, region: Regions.Red, x: 2886, y: 910 },
83
+ { name: Cities.Taiyuan, region: Regions.Red, x: 2588, y: 1130 },
84
+ { name: Cities.Badtou, region: Regions.Red, x: 2500, y: 862 },
85
+ { name: Cities.Fuzhou, region: Regions.Brown, x: 3290, y: 2132 },
86
+ { name: Cities.Nanchang, region: Regions.Brown, x: 3004, y: 1974 },
87
+ { name: Cities.Chaozhou, region: Regions.Brown, x: 3096, y: 2322 },
88
+ { name: Cities.Hongkong, region: Regions.Brown, x: 2902, y: 2552 },
89
+ { name: Cities.Guangzhou, region: Regions.Brown, x: 2694, y: 2352 },
90
+ { name: Cities.Changsha, region: Regions.Brown, x: 2682, y: 1988 },
91
+ { name: Cities.Wuhan, region: Regions.Brown, x: 2810, y: 1786 },
92
+ { name: Cities.Hami, region: Regions.Purple, x: 1816, y: 698 },
93
+ { name: Cities.Karamay, region: Regions.Purple, x: 1304, y: 372 },
94
+ { name: Cities.Wulumuqi, region: Regions.Purple, x: 1520, y: 558 },
95
+ { name: Cities.Kuerle, region: Regions.Purple, x: 1326, y: 756 },
96
+ { name: Cities.Yinchjan, region: Regions.Purple, x: 2208, y: 1058 },
97
+ { name: Cities.Xining, region: Regions.Purple, x: 1868, y: 1226 },
98
+ { name: Cities.Lanzhou, region: Regions.Purple, x: 2142, y: 1328 },
99
+ { name: Cities.Kunming, region: Regions.Yellow, x: 1840, y: 2248 },
100
+ { name: Cities.Chengou, region: Regions.Yellow, x: 1988, y: 1736 },
101
+ { name: Cities.Xian, region: Regions.Yellow, x: 2440, y: 1478 },
102
+ { name: Cities.Chongqing, region: Regions.Yellow, x: 2300, y: 1880 },
103
+ { name: Cities.Nanning, region: Regions.Yellow, x: 2318, y: 2452 },
104
+ { name: Cities.Haikou, region: Regions.Yellow, x: 2524, y: 2680 },
105
+ { name: Cities.Chiyang, region: Regions.Yellow, x: 2212, y: 2112 },
106
+ ],
107
+ connections: [
108
+ { nodes: [Cities.Kunming, Cities.Chengou], cost: 16 },
109
+ { nodes: [Cities.Nanning, Cities.Haikou], cost: 10 },
110
+ { nodes: [Cities.Guangzhou, Cities.Hongkong], cost: 4 },
111
+ { nodes: [Cities.Guangzhou, Cities.Chaozhou], cost: 7 },
112
+ { nodes: [Cities.Chaozhou, Cities.Hongkong], cost: 7 },
113
+ { nodes: [Cities.Guangzhou, Cities.Haikou], cost: 13 },
114
+ { nodes: [Cities.Nanning, Cities.Guangzhou], cost: 11 },
115
+ { nodes: [Cities.Xining, Cities.Chengou], cost: 20 },
116
+ { nodes: [Cities.Chengou, Cities.Chongqing], cost: 6 },
117
+ { nodes: [Cities.Chongqing, Cities.Chiyang], cost: 9 },
118
+ { nodes: [Cities.Chiyang, Cities.Kunming], cost: 12 },
119
+ { nodes: [Cities.Chiyang, Cities.Nanning], cost: 12 },
120
+ { nodes: [Cities.Chiyang, Cities.Guangzhou], cost: 18 },
121
+ { nodes: [Cities.Guangzhou, Cities.Changsha], cost: 14 },
122
+ { nodes: [Cities.Changsha, Cities.Chongqing], cost: 16 },
123
+ { nodes: [Cities.Changsha, Cities.Wuhan], cost: 6 },
124
+ { nodes: [Cities.Wuhan, Cities.Nanchang], cost: 6 },
125
+ { nodes: [Cities.Nanchang, Cities.Changsha], cost: 7 },
126
+ { nodes: [Cities.Changsha, Cities.Chiyang], cost: 15 },
127
+ { nodes: [Cities.Chiyang, Cities.Chengou], cost: 13 },
128
+ { nodes: [Cities.Guangzhou, Cities.Nanchang], cost: 16 },
129
+ { nodes: [Cities.Nanchang, Cities.Chaozhou], cost: 14 },
130
+ { nodes: [Cities.Chaozhou, Cities.Fuzhou], cost: 9 },
131
+ { nodes: [Cities.Fuzhou, Cities.Nanchang], cost: 13 },
132
+ { nodes: [Cities.Wuhan, Cities.Hangzhou], cost: 13 },
133
+ { nodes: [Cities.Hangzhou, Cities.Fuzhou], cost: 13 },
134
+ { nodes: [Cities.Hangzhou, Cities.Shanghai], cost: 4 },
135
+ { nodes: [Cities.Shanghai, Cities.Nanjing], cost: 6 },
136
+ { nodes: [Cities.Nanjing, Cities.Hangzhou], cost: 5 },
137
+ { nodes: [Cities.Hangzhou, Cities.Nanchang], cost: 10 },
138
+ { nodes: [Cities.Chongqing, Cities.Wuhan], cost: 18 },
139
+ { nodes: [Cities.Lanzhou, Cities.Chengou], cost: 16 },
140
+ { nodes: [Cities.Chengou, Cities.Xian], cost: 14 },
141
+ { nodes: [Cities.Xian, Cities.Chongqing], cost: 14 },
142
+ { nodes: [Cities.Xian, Cities.Wuhan], cost: 15 },
143
+ { nodes: [Cities.Wuhan, Cities.Zhengzhou], cost: 10 },
144
+ { nodes: [Cities.Zhengzhou, Cities.Xian], cost: 10 },
145
+ { nodes: [Cities.Xian, Cities.Lanzhou], cost: 15 },
146
+ { nodes: [Cities.Lanzhou, Cities.Yinchjan], cost: 9 },
147
+ { nodes: [Cities.Yinchjan, Cities.Xining], cost: 11 },
148
+ { nodes: [Cities.Lanzhou, Cities.Taiyuan], cost: 18 },
149
+ { nodes: [Cities.Taiyuan, Cities.Xian], cost: 12 },
150
+ { nodes: [Cities.Taiyuan, Cities.Zhengzhou], cost: 11 },
151
+ { nodes: [Cities.Taiyuan, Cities.Shijiazhuang], cost: 5 },
152
+ { nodes: [Cities.Shijiazhuang, Cities.Tianjin], cost: 5 },
153
+ { nodes: [Cities.Shijiazhuang, Cities.Jinan], cost: 6 },
154
+ { nodes: [Cities.Shijiazhuang, Cities.Zhengzhou], cost: 9 },
155
+ { nodes: [Cities.Zhengzhou, Cities.Jinan], cost: 7 },
156
+ { nodes: [Cities.Zhengzhou, Cities.Nanjing], cost: 12 },
157
+ { nodes: [Cities.Nanjing, Cities.Wuhan], cost: 10 },
158
+ { nodes: [Cities.Jinan, Cities.Nanjing], cost: 11 },
159
+ { nodes: [Cities.Nanjing, Cities.Qingoad], cost: 12 },
160
+ { nodes: [Cities.Qingoad, Cities.Jinan], cost: 6 },
161
+ { nodes: [Cities.Jinan, Cities.Tianjin], cost: 6 },
162
+ { nodes: [Cities.Xining, Cities.Lanzhou], cost: 6 },
163
+ { nodes: [Cities.Yinchjan, Cities.Badtou], cost: 9 },
164
+ { nodes: [Cities.Badtou, Cities.Taiyuan], cost: 9 },
165
+ { nodes: [Cities.Taiyuan, Cities.Yinchjan], cost: 14 },
166
+ { nodes: [Cities.Yinchjan, Cities.Hami], cost: 25 },
167
+ { nodes: [Cities.Hami, Cities.Xining], cost: 25 },
168
+ { nodes: [Cities.Wulumuqi, Cities.Kuerle], cost: 9 },
169
+ { nodes: [Cities.Kuerle, Cities.Karamay], cost: 12 },
170
+ { nodes: [Cities.Karamay, Cities.Wulumuqi], cost: 7 },
171
+ { nodes: [Cities.Wulumuqi, Cities.Hami], cost: 12 },
172
+ { nodes: [Cities.Hami, Cities.Kuerle], cost: 15 },
173
+ { nodes: [Cities.Taiyuan, Cities.Beijing], cost: 10 },
174
+ { nodes: [Cities.Beijing, Cities.Shijiazhuang], cost: 6 },
175
+ { nodes: [Cities.Beijing, Cities.Tangshan], cost: 3 },
176
+ { nodes: [Cities.Tangshan, Cities.Tianjin], cost: 0 },
177
+ { nodes: [Cities.Beijing, Cities.Badtou], cost: 14 },
178
+ { nodes: [Cities.Tangshan, Cities.Shenyang], cost: 11 },
179
+ { nodes: [Cities.Dalian, Cities.Anshan], cost: 6 },
180
+ { nodes: [Cities.Qiqhaer, Cities.Hegang], cost: 11 },
181
+ { nodes: [Cities.Hegang, Cities.Haerbin], cost: 7 },
182
+ { nodes: [Cities.Haerbin, Cities.Qiqhaer], cost: 6 },
183
+ { nodes: [Cities.Changchun, Cities.Jilin], cost: 5 },
184
+ { nodes: [Cities.Jilin, Cities.Haerbin], cost: 5 },
185
+ { nodes: [Cities.Haerbin, Cities.Changchun], cost: 5 },
186
+ { nodes: [Cities.Changchun, Cities.Shenyang], cost: 5 },
187
+ { nodes: [Cities.Shenyang, Cities.Anshan], cost: 2 },
188
+ { nodes: [Cities.Jilin, Cities.Fushun], cost: 6 },
189
+ { nodes: [Cities.Fushun, Cities.Shenyang], cost: 0 },
190
+ { nodes: [Cities.Changchun, Cities.Qiqhaer], cost: 9 },
191
+ ],
192
+ layout: 'Portrait',
193
+ mapPosition: [-400, 70],
194
+ adjustRatio: [0.35, 0.35],
195
+ resupply: [
196
+ [
197
+ [4, 4, 3],
198
+ [5, 5, 3],
199
+ [6, 6, 4],
200
+ [7, 7, 5],
201
+ [9, 9, 6],
202
+ ],
203
+ [
204
+ [2, 2, 4],
205
+ [3, 3, 4],
206
+ [4, 4, 5],
207
+ [5, 5, 6],
208
+ [6, 6, 7],
209
+ ],
210
+ [
211
+ [2, 2, 1],
212
+ [2, 2, 1],
213
+ [3, 3, 2],
214
+ [3, 3, 3],
215
+ [5, 5, 3],
216
+ ],
217
+ [
218
+ [1, 1, 1],
219
+ [1, 1, 1],
220
+ [2, 2, 2],
221
+ [3, 3, 2],
222
+ [3, 3, 3],
223
+ ],
224
+ ],
225
+ startingResources: [12, 12, 6, 0],
226
+ setupDeck(numPlayers: number, variant: string, rng: seedrandom.prng) {
227
+ /* Instructions for power plant setup:
228
+ Depending on the number of players, remove the following power plants from the game and place them in the box:
229
+ with 2 and 3 players: 3, 4, 9, 11, 16, 18, 20, 24, 30, 33, 46.
230
+ with 4 players: 3, 4, 11, 18, 24, 33, 46.
231
+ with 5 and 6 players: 3, 4, 33.
232
+ Sort the remaining power plants as described below and place them as a face-down supply:
233
+ plants 36– 50: shuffle and place face-down at the bottom of the supply
234
+ plants 31–35: (naturally without 33) shuffle along with the step 3 card and place face-down on top of the higher numbers
235
+ already placed on the supply
236
+ plants 5 – 30: sort in ascending order with 30 on the bottom and 5 on the top and place face-down on the supply
237
+ */
238
+ const allPlants = cloneDeep(powerPlants);
239
+ let plantsToRemove: number[] = [];
240
+ if (numPlayers == 2 || numPlayers == 3) {
241
+ plantsToRemove = [3, 4, 9, 11, 16, 18, 20, 24, 30, 33, 46];
242
+ } else if (numPlayers == 4) {
243
+ plantsToRemove = [3, 4, 11, 18, 24, 33, 46];
244
+ } else if (numPlayers == 5 || numPlayers == 6) {
245
+ plantsToRemove = [3, 4, 33];
246
+ }
247
+ const filteredPlants = allPlants.filter((p) => !plantsToRemove.includes(p.number));
248
+
249
+ const lowPlants = filteredPlants.filter((p) => p.number <= 30);
250
+ const step3Card = filteredPlants.filter((p) => p.type == PowerPlantType.Step3);
251
+ const middlePlants = shuffle(
252
+ filteredPlants.filter((p) => p.number >= 31 && p.number <= 35).concat(step3Card),
253
+ rng() + ''
254
+ );
255
+ const highPlants = shuffle(
256
+ filteredPlants.filter((p) => p.number >= 36 && p.number <= 50),
257
+ rng() + ''
258
+ );
259
+
260
+ // In round 1, the number of plants available is equal to the number of players.
261
+ const actualMarket = lowPlants.splice(0, numPlayers);
262
+ const futureMarket: PowerPlant[] = [];
263
+ const powerPlantsDeck = lowPlants.concat(middlePlants).concat(highPlants);
264
+ return { actualMarket, futureMarket, powerPlantsDeck };
265
+ },
266
+ mapSpecificRules:
267
+ 'The power plant deck is arranged as follows: plants from 3-30 in order, plants from 31-35 and step 3 card shuffled, plants from 36-50 shuffled.\nThe same set of plants are removed in every game.\nThere are several changes to when new plants are drawn. In particular, during steps 1 and 2, plants are only drawn from the deck during the bureaucracy phase.',
268
+ };
@@ -0,0 +1,295 @@
1
+ import { cloneDeep } from 'lodash';
2
+ import seedrandom from 'seedrandom';
3
+ import { getPowerPlant } from '../engine';
4
+ import { PowerPlant } from '../gamestate';
5
+ import { shuffle } from '../utils';
6
+ import { GameMap } from './../maps';
7
+ import { powerPlants } from './../powerPlants';
8
+
9
+ export enum Regions {
10
+ Brown = 'brown',
11
+ Purple = 'purple',
12
+ Blue = 'blue',
13
+ Yellow = 'yellow',
14
+ Green = 'green',
15
+ Red = 'red',
16
+ }
17
+
18
+ export enum Cities {
19
+ Calais = 'Calais',
20
+ Lile = 'Lile',
21
+ Amiens = 'Amiens',
22
+ Reims = 'Reims',
23
+ Metz = 'Metz',
24
+ Nancy = 'Nancy',
25
+ Strasbourg = 'Strasbourg',
26
+ Havre = 'Havre',
27
+ Caen = 'Caen',
28
+ Brest = 'Brest',
29
+ Rennes = 'Rennes',
30
+ Lemans = 'Le Mans',
31
+ Angers = 'Angers',
32
+ Rouen = 'Rouen',
33
+ Paris1 = 'Paris 1',
34
+ Paris2 = 'Paris 2',
35
+ Paris3 = 'Paris 3',
36
+ Orleans = 'Orleans',
37
+ Tours = 'Tours',
38
+ Limoges = 'Limoges',
39
+ Clermontferrand = 'Clermont-Ferrand',
40
+ Besancon = 'Besancon',
41
+ Dijon = 'Dijon',
42
+ Lyon = 'Lyon',
43
+ Chamonix = 'Chamonix',
44
+ Mulhouse = 'Mulhouse',
45
+ Grenoble = 'Grenoble',
46
+ Saintetienne = 'Saint-Etienne',
47
+ Nice = 'Nice',
48
+ Toulon = 'Toulon',
49
+ Aimenprovence = 'Aim-En-Provence',
50
+ Marseille = 'Marseille',
51
+ Nimes = 'Nimes',
52
+ Montpellier = 'Montpellier',
53
+ Perpignan = 'Perpignan',
54
+ Nantes = 'Nantes',
55
+ Larochelle = 'La Rochelle',
56
+ Bordeaux = 'Bordeaux',
57
+ Biarritz = 'Biarritz',
58
+ Toulous = 'Toulous',
59
+ Carcassone = 'Carcas Sone',
60
+ Lourdes = 'Lourdes',
61
+ }
62
+
63
+ export const map: GameMap = {
64
+ name: 'France',
65
+ cities: [
66
+ { name: Cities.Calais, region: Regions.Brown, x: 661, y: 294 },
67
+ { name: Cities.Lile, region: Regions.Brown, x: 791, y: 328 },
68
+ { name: Cities.Amiens, region: Regions.Brown, x: 700, y: 433 },
69
+ { name: Cities.Reims, region: Regions.Brown, x: 888, y: 531 },
70
+ { name: Cities.Metz, region: Regions.Brown, x: 1076, y: 528 },
71
+ { name: Cities.Nancy, region: Regions.Brown, x: 1078, y: 643 },
72
+ { name: Cities.Strasbourg, region: Regions.Brown, x: 1208, y: 615 },
73
+ { name: Cities.Havre, region: Regions.Purple, x: 487, y: 471 },
74
+ { name: Cities.Caen, region: Regions.Purple, x: 423, y: 567 },
75
+ { name: Cities.Brest, region: Regions.Purple, x: 79, y: 654 },
76
+ { name: Cities.Rennes, region: Regions.Purple, x: 326, y: 695 },
77
+ { name: Cities.Lemans, region: Regions.Purple, x: 516, y: 699 },
78
+ { name: Cities.Angers, region: Regions.Purple, x: 446, y: 798 },
79
+ { name: Cities.Rouen, region: Regions.Purple, x: 598, y: 506 },
80
+ { name: Cities.Paris1, region: Regions.Blue, x: 693, y: 553 },
81
+ { name: Cities.Paris2, region: Regions.Blue, x: 779, y: 566 },
82
+ { name: Cities.Paris3, region: Regions.Blue, x: 722, y: 633 },
83
+ { name: Cities.Orleans, region: Regions.Blue, x: 684, y: 736 },
84
+ { name: Cities.Tours, region: Regions.Blue, x: 564, y: 813 },
85
+ { name: Cities.Limoges, region: Regions.Blue, x: 605, y: 1009 },
86
+ { name: Cities.Clermontferrand, region: Regions.Blue, x: 777, y: 1017 },
87
+ { name: Cities.Besancon, region: Regions.Yellow, x: 1084, y: 828 },
88
+ { name: Cities.Dijon, region: Regions.Yellow, x: 964, y: 801 },
89
+ { name: Cities.Lyon, region: Regions.Yellow, x: 964, y: 973 },
90
+ { name: Cities.Chamonix, region: Regions.Yellow, x: 1153, y: 987 },
91
+ { name: Cities.Mulhouse, region: Regions.Yellow, x: 1180, y: 742 },
92
+ { name: Cities.Grenoble, region: Regions.Yellow, x: 1048, y: 1116 },
93
+ { name: Cities.Saintetienne, region: Regions.Yellow, x: 892, y: 1088 },
94
+ { name: Cities.Nice, region: Regions.Green, x: 1178, y: 1302 },
95
+ { name: Cities.Toulon, region: Regions.Green, x: 1070, y: 1397 },
96
+ { name: Cities.Aimenprovence, region: Regions.Green, x: 1016, y: 1304 },
97
+ { name: Cities.Marseille, region: Regions.Green, x: 954, y: 1369 },
98
+ { name: Cities.Nimes, region: Regions.Green, x: 889, y: 1256 },
99
+ { name: Cities.Montpellier, region: Regions.Green, x: 816, y: 1330 },
100
+ { name: Cities.Perpignan, region: Regions.Green, x: 767, y: 1460 },
101
+ { name: Cities.Nantes, region: Regions.Red, x: 330, y: 833 },
102
+ { name: Cities.Larochelle, region: Regions.Red, x: 379, y: 959 },
103
+ { name: Cities.Bordeaux, region: Regions.Red, x: 435, y: 1148 },
104
+ { name: Cities.Biarritz, region: Regions.Red, x: 345, y: 1328 },
105
+ { name: Cities.Toulous, region: Regions.Red, x: 621, y: 1309 },
106
+ { name: Cities.Carcassone, region: Regions.Red, x: 700, y: 1382 },
107
+ { name: Cities.Lourdes, region: Regions.Red, x: 479, y: 1393 },
108
+ ],
109
+ connections: [
110
+ { nodes: [Cities.Calais, Cities.Havre], cost: 13 },
111
+ { nodes: [Cities.Calais, Cities.Lile], cost: 7 },
112
+ { nodes: [Cities.Calais, Cities.Amiens], cost: 8 },
113
+ { nodes: [Cities.Lile, Cities.Reims], cost: 9 },
114
+ { nodes: [Cities.Havre, Cities.Rouen], cost: 5 },
115
+ { nodes: [Cities.Havre, Cities.Caen], cost: 5 },
116
+ { nodes: [Cities.Caen, Cities.Rennes], cost: 12 },
117
+ { nodes: [Cities.Rennes, Cities.Brest], cost: 16 },
118
+ { nodes: [Cities.Brest, Cities.Nantes], cost: 19 },
119
+ { nodes: [Cities.Rennes, Cities.Nantes], cost: 7 },
120
+ { nodes: [Cities.Rennes, Cities.Angers], cost: 7 },
121
+ { nodes: [Cities.Rennes, Cities.Lemans], cost: 9 },
122
+ { nodes: [Cities.Caen, Cities.Lemans], cost: 10 },
123
+ { nodes: [Cities.Lemans, Cities.Paris3], cost: 10 },
124
+ { nodes: [Cities.Paris3, Cities.Caen], cost: 12 },
125
+ { nodes: [Cities.Caen, Cities.Rouen], cost: 9 },
126
+ { nodes: [Cities.Rouen, Cities.Paris1], cost: 9 },
127
+ { nodes: [Cities.Rouen, Cities.Amiens], cost: 6 },
128
+ { nodes: [Cities.Lile, Cities.Amiens], cost: 7 },
129
+ { nodes: [Cities.Amiens, Cities.Reims], cost: 11 },
130
+ { nodes: [Cities.Reims, Cities.Metz], cost: 12 },
131
+ { nodes: [Cities.Metz, Cities.Strasbourg], cost: 11 },
132
+ { nodes: [Cities.Strasbourg, Cities.Nancy], cost: 10 },
133
+ { nodes: [Cities.Strasbourg, Cities.Mulhouse], cost: 6 },
134
+ { nodes: [Cities.Mulhouse, Cities.Besancon], cost: 8 },
135
+ { nodes: [Cities.Besancon, Cities.Nancy], cost: 14 },
136
+ { nodes: [Cities.Nancy, Cities.Dijon], cost: 15 },
137
+ { nodes: [Cities.Reims, Cities.Nancy], cost: 13 },
138
+ { nodes: [Cities.Nancy, Cities.Paris2], cost: 21 },
139
+ { nodes: [Cities.Paris1, Cities.Paris2], cost: 0 },
140
+ { nodes: [Cities.Paris1, Cities.Paris3], cost: 0 },
141
+ { nodes: [Cities.Paris2, Cities.Dijon], cost: 20 },
142
+ { nodes: [Cities.Dijon, Cities.Orleans], cost: 18 },
143
+ { nodes: [Cities.Orleans, Cities.Lemans], cost: 8 },
144
+ { nodes: [Cities.Lemans, Cities.Tours], cost: 5 },
145
+ { nodes: [Cities.Tours, Cities.Orleans], cost: 7 },
146
+ { nodes: [Cities.Paris1, Cities.Amiens], cost: 9 },
147
+ { nodes: [Cities.Dijon, Cities.Clermontferrand], cost: 19 },
148
+ { nodes: [Cities.Clermontferrand, Cities.Limoges], cost: 12 },
149
+ { nodes: [Cities.Limoges, Cities.Toulous], cost: 19 },
150
+ { nodes: [Cities.Toulous, Cities.Clermontferrand], cost: 24 },
151
+ { nodes: [Cities.Clermontferrand, Cities.Montpellier], cost: 22 },
152
+ { nodes: [Cities.Montpellier, Cities.Nimes], cost: 3 },
153
+ { nodes: [Cities.Saintetienne, Cities.Grenoble], cost: 10 },
154
+ { nodes: [Cities.Grenoble, Cities.Chamonix], cost: 12 },
155
+ { nodes: [Cities.Chamonix, Cities.Besancon], cost: 19 },
156
+ { nodes: [Cities.Besancon, Cities.Dijon], cost: 6 },
157
+ { nodes: [Cities.Dijon, Cities.Lyon], cost: 13 },
158
+ { nodes: [Cities.Lyon, Cities.Clermontferrand], cost: 11 },
159
+ { nodes: [Cities.Saintetienne, Cities.Montpellier], cost: 18 },
160
+ { nodes: [Cities.Saintetienne, Cities.Nimes], cost: 16 },
161
+ { nodes: [Cities.Nimes, Cities.Aimenprovence], cost: 8 },
162
+ { nodes: [Cities.Aimenprovence, Cities.Nice], cost: 8 },
163
+ { nodes: [Cities.Nice, Cities.Toulon], cost: 7 },
164
+ { nodes: [Cities.Toulon, Cities.Marseille], cost: 3 },
165
+ { nodes: [Cities.Marseille, Cities.Aimenprovence], cost: 0 },
166
+ { nodes: [Cities.Nice, Cities.Grenoble], cost: 19 },
167
+ { nodes: [Cities.Grenoble, Cities.Aimenprovence], cost: 17 },
168
+ { nodes: [Cities.Grenoble, Cities.Nimes], cost: 18 },
169
+ { nodes: [Cities.Montpellier, Cities.Toulous], cost: 14 },
170
+ { nodes: [Cities.Toulous, Cities.Bordeaux], cost: 14 },
171
+ { nodes: [Cities.Bordeaux, Cities.Limoges], cost: 13 },
172
+ { nodes: [Cities.Limoges, Cities.Tours], cost: 13 },
173
+ { nodes: [Cities.Tours, Cities.Larochelle], cost: 13 },
174
+ { nodes: [Cities.Larochelle, Cities.Angers], cost: 12 },
175
+ { nodes: [Cities.Angers, Cities.Lemans], cost: 5 },
176
+ { nodes: [Cities.Angers, Cities.Nantes], cost: 5 },
177
+ { nodes: [Cities.Nantes, Cities.Larochelle], cost: 9 },
178
+ { nodes: [Cities.Larochelle, Cities.Bordeaux], cost: 13 },
179
+ { nodes: [Cities.Bordeaux, Cities.Biarritz], cost: 12 },
180
+ { nodes: [Cities.Bordeaux, Cities.Lourdes], cost: 14 },
181
+ { nodes: [Cities.Lourdes, Cities.Biarritz], cost: 9 },
182
+ { nodes: [Cities.Lourdes, Cities.Toulous], cost: 10 },
183
+ { nodes: [Cities.Lourdes, Cities.Carcassone], cost: 15 },
184
+ { nodes: [Cities.Lourdes, Cities.Perpignan], cost: 20 },
185
+ { nodes: [Cities.Perpignan, Cities.Carcassone], cost: 6 },
186
+ { nodes: [Cities.Carcassone, Cities.Toulous], cost: 6 },
187
+ { nodes: [Cities.Carcassone, Cities.Montpellier], cost: 9 },
188
+ { nodes: [Cities.Montpellier, Cities.Perpignan], cost: 11 },
189
+ { nodes: [Cities.Orleans, Cities.Limoges], cost: 19 },
190
+ { nodes: [Cities.Orleans, Cities.Clermontferrand], cost: 18 },
191
+ { nodes: [Cities.Paris3, Cities.Orleans], cost: 7 },
192
+ { nodes: [Cities.Angers, Cities.Tours], cost: 6 },
193
+ { nodes: [Cities.Larochelle, Cities.Limoges], cost: 13 },
194
+ { nodes: [Cities.Nancy, Cities.Metz], cost: 3 },
195
+ { nodes: [Cities.Nancy, Cities.Mulhouse], cost: 12 },
196
+ { nodes: [Cities.Besancon, Cities.Lyon], cost: 16 },
197
+ { nodes: [Cities.Lyon, Cities.Grenoble], cost: 7 },
198
+ { nodes: [Cities.Lyon, Cities.Chamonix], cost: 13 },
199
+ { nodes: [Cities.Lyon, Cities.Saintetienne], cost: 6 },
200
+ { nodes: [Cities.Saintetienne, Cities.Clermontferrand], cost: 10 },
201
+ { nodes: [Cities.Paris2, Cities.Reims], cost: 9 },
202
+ { nodes: [Cities.Paris3, Cities.Paris2], cost: 0 },
203
+ ],
204
+ layout: 'Portrait',
205
+ mapPosition: [50, -100],
206
+ adjustRatio: [0.7, 0.7],
207
+ resupply: [
208
+ [
209
+ [3, 4, 3],
210
+ [4, 5, 3],
211
+ [5, 6, 4],
212
+ [5, 7, 5],
213
+ [7, 9, 6],
214
+ ],
215
+ [
216
+ [2, 2, 4],
217
+ [2, 3, 4],
218
+ [3, 4, 5],
219
+ [4, 5, 6],
220
+ [5, 6, 7],
221
+ ],
222
+ [
223
+ [1, 2, 3],
224
+ [1, 2, 3],
225
+ [2, 3, 4],
226
+ [3, 3, 5],
227
+ [3, 5, 6],
228
+ ],
229
+ [
230
+ [1, 1, 1],
231
+ [1, 1, 1],
232
+ [1, 2, 2],
233
+ [2, 3, 2],
234
+ [2, 3, 3],
235
+ ],
236
+ ],
237
+ startingResources: [24, 18, 6, 8],
238
+ setupDeck(numPlayers: number, variant: string, rng: seedrandom.prng) {
239
+ let powerPlantsDeck = cloneDeep(powerPlants);
240
+ let actualMarket: PowerPlant[];
241
+ let futureMarket: PowerPlant[];
242
+
243
+ if (variant == 'original') {
244
+ powerPlantsDeck = powerPlantsDeck.slice(8);
245
+ const powerPlant11 = powerPlantsDeck.splice(0, 1)[0];
246
+ powerPlantsDeck.splice(1, 1)[0];
247
+ const step3 = powerPlantsDeck.pop()!;
248
+
249
+ powerPlantsDeck = shuffle(powerPlantsDeck, rng() + '');
250
+ if (numPlayers == 2 || numPlayers == 3) {
251
+ powerPlantsDeck = powerPlantsDeck.slice(8);
252
+ } else if (numPlayers == 4) {
253
+ powerPlantsDeck = powerPlantsDeck.slice(4);
254
+ }
255
+
256
+ powerPlantsDeck.unshift(powerPlant11);
257
+ powerPlantsDeck.push(step3);
258
+
259
+ actualMarket = [getPowerPlant(3), getPowerPlant(4), getPowerPlant(5), getPowerPlant(6)];
260
+ futureMarket = [getPowerPlant(7), getPowerPlant(8), getPowerPlant(9), getPowerPlant(10)];
261
+ } else {
262
+ // Remove power plant 13
263
+ powerPlantsDeck.splice(10, 1)[0];
264
+ const powerPlant11 = powerPlantsDeck.splice(8, 1)[0];
265
+
266
+ let initialPowerPlants = shuffle(powerPlantsDeck.splice(0, 11), rng() + '');
267
+ let initialPlantMarket = initialPowerPlants.splice(0, 7);
268
+ initialPlantMarket.push(powerPlant11);
269
+ initialPlantMarket = initialPlantMarket.sort((a, b) => a.number - b.number);
270
+ actualMarket = initialPlantMarket.slice(0, 4);
271
+ futureMarket = initialPlantMarket.slice(4);
272
+
273
+ const first = initialPowerPlants.shift()!;
274
+ const step3 = powerPlantsDeck.pop()!;
275
+
276
+ powerPlantsDeck = shuffle(powerPlantsDeck, rng() + '');
277
+ if (numPlayers == 2) {
278
+ powerPlantsDeck = shuffle(powerPlantsDeck.slice(6).concat(initialPowerPlants), rng() + '');
279
+ } else if (numPlayers == 3) {
280
+ initialPowerPlants = initialPowerPlants.slice(1);
281
+ powerPlantsDeck = shuffle(powerPlantsDeck.slice(6).concat(initialPowerPlants), rng() + '');
282
+ } else if (numPlayers == 4) {
283
+ powerPlantsDeck = shuffle(powerPlantsDeck.slice(3).concat(initialPowerPlants), rng() + '');
284
+ } else {
285
+ powerPlantsDeck = shuffle(powerPlantsDeck.concat(initialPowerPlants), rng() + '');
286
+ }
287
+
288
+ powerPlantsDeck.unshift(first);
289
+ powerPlantsDeck.push(step3);
290
+ }
291
+
292
+ return { actualMarket, futureMarket, powerPlantsDeck };
293
+ },
294
+ mapSpecificRules: 'Remove power plant 13. Put power plant 11 on top of the deck.',
295
+ };