summaryrefslogtreecommitdiff
path: root/tools/gendata.js
blob: e7f5df6e9b2db47508bd4229b6be301540ae52cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
let fs = require("fs")

let data = {}

const GOVT = 0
const FARC = 1
const AUC = 2
const CARTELS = 3

const BASE = 0
const GUERRILLA = 1
const TROOPS = 2
const POLICE = 3

function to_ascii(s) {
	return s.normalize("NFD").replace(/[\u0300-\u036f]/g, "")
}

const IMAP = { G: GOVT, F: FARC, A: AUC, C: CARTELS }
let order = null
let card_name = [ null ]
let card_order = [ null ]
function def_order(s) {
	order = [ IMAP[s[0]], IMAP[s[1]], IMAP[s[2]], IMAP[s[3]] ]
}
function def_card(number, name) {
	card_name[number] = name
	card_order[number] = order
}
def_order("GFAC")
def_card(1, "1st Division")
def_card(2, "Ospina & Mora")
def_card(3, "Tapias")
def_order("GFCA")
def_card(4, "Caño Limón - Coveñas")
def_card(5, "Occidental & Ecopetrol")
def_card(6, "Oil Spill")
def_order("GAFC")
def_card(7, "7th Special Forces")
def_card(8, "Fuerza Aérea Colombiana")
def_card(9, "High Mountain Battalions")
def_order("GACF")
def_card(10, "Blackhawks")
def_card(11, "National Defense & Security Council")
def_card(12, "Plan Colombia")
def_order("GCFA")
def_card(13, "Plan Meteoro")
def_card(14, "Tres Esquinas")
def_card(15, "War Tax")
def_order("GCAF")
def_card(16, "Coffee Prices")
def_card(17, "Madrid Donors")
def_card(18, "NSPD-18")
def_order("FGAC")
def_card(19, "General Offensive")
def_card(20, "Mono Jojoy")
def_card(21, "Raúl Reyes")
def_order("FGCA")
def_card(22, "Alfonso Cano")
def_card(23, "DoD Contractors")
def_card(24, "Operación Jaque")
def_order("FAGC")
def_card(25, "Ejército de Liberación Nacional")
def_card(26, "Gramaje")
def_card(27, "Misil Antiaéreo")
def_order("FACG")
def_card(28, "Hugo Chávez")
def_card(29, "Kill Zone")
def_card(30, "Peace Commission")
def_order("FCGA")
def_card(31, "Betancourt")
def_card(32, "Secuestrados")
def_card(33, "Sucumbíos")
def_order("FCAG")
def_card(34, "Airdropped AKs")
def_card(35, "Crop Substitution")
def_card(36, "Zona de Convivencia")
def_order("AGFC")
def_card(37, "Former Military")
def_card(38, "National Coordination Center")
def_card(39, "Soldados Campesinos")
def_order("AGCF")
def_card(40, "Demobilization")
def_card(41, "Mancuso")
def_card(42, "Senado & Cámara")
def_order("AFGC")
def_card(43, "Calima Front")
def_card(44, "Colombia Nueva")
def_card(45, "Los Derechos Humanos")
def_order("AFCG")
def_card(46, "Limpieza")
def_card(47, "Pinto & del Rosario")
def_card(48, "Unión Sindical Obrera")
def_order("ACGF")
def_card(49, "Bloques")
def_card(50, "Carabineros")
def_card(51, "Pipeline Repairs")
def_order("ACFG")
def_card(52, "Castaño")
def_card(53, "Criminal Air Force")
def_card(54, "Deserters & Defectors")
def_order("CGFA")
def_card(55, "DEA Agents")
def_card(56, "Drogas La Rebaja")
def_card(57, "Op Millennium")
def_order("CGAF")
def_card(58, "General Serrano")
def_card(59, "Salcedo")
def_card(60, "The Chess Player")
def_order("CFGA")
def_card(61, "Air Bridge")
def_card(62, "Amazonía")
def_card(63, "Narco-War")
def_order("CFAG")
def_card(64, "Cocaine Labs")
def_card(65, "Poppies")
def_card(66, "Tingo María")
def_order("CAGF")
def_card(67, "Mexican Traffickers")
def_card(68, "Narco-Subs")
def_card(69, "Riverines & Fast Boats")
def_order("CAFG")
def_card(70, "Ayahuasca Tourism")
def_card(71, "Darién")
def_card(72, "Sicarios")

def_order("GFAC")
def_card(73, "Propaganda!")
def_card(74, "Propaganda!")
def_card(75, "Propaganda!")
def_card(76, "Propaganda!")

let spaces = [ ]
let space_name = [ ]

function add(list, item) {
	if (!list.includes(item))
		list.push(item)
}

function def_space(type, pop, name) {
	spaces.push({ type, id: to_ascii(name), pop, adjacent: [] })
	space_name.push(name)
}

function def_town(name) {
	spaces.push({ type: "town", id: to_ascii(name), adjacent: [] })
	space_name.push(name)
}

function def_loc(type, econ, cities, depts) {
	let name = cities.join(" / ")
	let loc_names = cities.concat(depts)
	let loc_spaces = loc_names.map(n => space_name.indexOf(n))
	let ix = spaces.length
	spaces.push({ type, name, id: to_ascii(name), econ, adjacent: loc_spaces.filter(x=>x>0) })
	for (let loc of loc_spaces)
		if (loc >= 0)
			add(spaces[loc].adjacent, ix)
	space_name.push(name)
	return ix
}

function adjacent(an, bn) {
	ax = space_name.indexOf(an)
	bx = space_name.indexOf(bn)
	add(spaces[ax].adjacent, bx)
	add(spaces[bx].adjacent, ax)
}

// Cities
data.first_pop = 1
data.first_city = spaces.length

def_space("city", 8, "Bogotá")
def_space("city", 3, "Cali")
def_space("city", 3, "Medellín")
def_space("city", 2, "Bucaramanga")
def_space("city", 2, "Ibagué")
def_space("city", 2, "Santa Marta")
def_space("city", 1, "Cartagena")
def_space("city", 1, "Cúcuta")
def_space("city", 1, "Neiva")
def_space("city", 1, "Pasto")
def_space("city", 1, "Sincelejo")

data.last_city = spaces.length-1

data.first_dept = spaces.length

// Departments
def_space("forest", 1, "Atlántico")
def_space("forest", 1, "Chocó")
def_space("forest", 1, "Nariño")
def_space("forest", 1, "Meta West")
def_space("forest", 1, "Guaviare")
def_space("forest", 1, "Putumayo")
def_space("mountain", 1, "Cesar")
def_space("mountain", 2, "Antioquia")
def_space("mountain", 2, "Santander")
def_space("mountain", 2, "Huila")
def_space("grassland", 1, "Arauca")
def_space("grassland", 1, "Meta East")

data.last_pop = spaces.length-1

def_space("grassland", 0, "Vichada")
def_space("forest", 0, "Guainía")
def_space("forest", 0, "Vaupés")
def_space("forest", 0, "Amazonas")

data.last_dept = spaces.length-1

data.first_foreign = spaces.length

// Foreign Countries
def_space("foreign", 0, "Brasil")
def_space("foreign", 0, "Ecuador")
def_space("foreign", 0, "Panamá")
def_space("foreign", 0, "Perú")
def_space("foreign", 0, "Venezuela")

data.last_foreign = spaces.length-1

// LoC

data.first_loc = spaces.length

def_loc("road", 1, [ "Santa Marta", "Cartagena"], [ "Atlántico" ])
def_loc("road", 1, [ "Cali", "Pasto"], [ "Nariño", "Huila" ])
def_loc("road", 1, [ "Neiva", "Pasto"], [ "Huila", "Putumayo" ])
def_loc("road", 1, [ "Bogotá", "San José" ], [ "Meta East", "Meta West", "Guaviare" ])

def_loc("road", 1, [ "Pasto", "Tumaco" ], [ "Nariño", "Ecuador" ])
def_loc("pipeline", 1, [ "Cali", "Buenaventura" ], [ "Chocó", "Nariño" ])

def_loc("pipeline", 1, [ "Cartagena", "Sincelejo"], [ "Atlántico" ])
def_loc("pipeline", 2, [ "Sincelejo", "Medellín"], [ "Chocó", "Antioquia" ])
def_loc("pipeline", 1, [ "Medellín", "Ibagué"], [ "Chocó", "Antioquia" ])
def_loc("pipeline", 1, [ "Ibagué", "Cali"], [ "Chocó", "Huila" ])

def_loc("pipeline", 2, [ "Bucaramanga", "Ibagué", "Bogotá" ], [ "Antioquia", "Santa", "Huila" ])
def_loc("pipeline", 2, [ "Bogotá", "Neiva" ], [ "Huila", "Meta West" ])
def_loc("pipeline", 3, [ "Cúcuta", "Arauca" ], [ "Venezuela", "Arauca", "Santaner" ])
def_loc("pipeline", 2, [ "Bogotá", "Yopal" ], [ "Santander", "Arauca", "Meta East"])

let ayacucho = [
	def_loc("pipeline", 2, [ "Santa Marta", "Ayacucho" ], [ "Cesar", "Santander", "Antioquia", "Atlántico" ]),
	def_loc("pipeline", 2, [ "Bucaramanga", "Ayacucho" ], [ "Antioquia", "Atlántico", "Cesar", "Santander" ]),
	def_loc("pipeline", 3, [ "Sincelejo", "Ayacucho" ], [ "Atlántico", "Cesar", "Santander", "Antioquia" ]),
	def_loc("pipeline", 3, [ "Cúcuta", "Ayacucho" ], [ "Santander", "Antioquia", "Atlántico", "Cesar", "Venezuela" ]),
]

for (let a of ayacucho) {
	for (let b of ayacucho)
		if (a !== b)
			add(spaces[a].adjacent, b)
}

data.last_loc = spaces.length-1

// City in Dept

adjacent("Santa Marta", "Cesar")
adjacent("Santa Marta", "Atlántico")
adjacent("Cartagena", "Atlántico")
adjacent("Sincelejo", "Atlántico")
adjacent("Sincelejo", "Antioquia")
adjacent("Sincelejo", "Chocó")
adjacent("Medellín", "Chocó")
adjacent("Medellín", "Antioquia")
adjacent("Ibagué", "Chocó")
adjacent("Ibagué", "Antioquia")
adjacent("Ibagué", "Huila")
adjacent("Cali", "Chocó")
adjacent("Cali", "Huila")
adjacent("Cali", "Nariño")
adjacent("Pasto", "Nariño")
adjacent("Pasto", "Huila")
adjacent("Pasto", "Putumayo")
adjacent("Pasto", "Ecuador")
adjacent("Cúcuta", "Venezuela")
adjacent("Cúcuta", "Santander")
adjacent("Bucaramanga", "Antioquia")
adjacent("Bucaramanga", "Santander")
adjacent("Bogotá", "Santander")
adjacent("Bogotá", "Meta East")
adjacent("Bogotá", "Meta West")
adjacent("Bogotá", "Huila")
adjacent("Neiva", "Huila")
adjacent("Neiva", "Meta West")
adjacent("Neiva", "Putumayo")

// Foreign - Dept

adjacent("Panamá", "Chocó")

adjacent("Venezuela", "Cesar")
adjacent("Venezuela", "Santander")
adjacent("Venezuela", "Arauca")
adjacent("Venezuela", "Vichada")
adjacent("Venezuela", "Guainía")

adjacent("Brasil", "Guainía")
adjacent("Brasil", "Vaupés")
adjacent("Brasil", "Amazonas")

adjacent("Ecuador", "Nariño")
adjacent("Ecuador", "Putumayo")

adjacent("Perú", "Putumayo")
adjacent("Perú", "Amazonas")

// Dept - Dept (with redundancies)

adjacent("Atlántico", "Cesar")
adjacent("Atlántico", "Santander")
adjacent("Atlántico", "Antioquia")

adjacent("Chocó", "Antioquia")
adjacent("Chocó", "Huila")
adjacent("Chocó", "Nariño")

adjacent("Nariño", "Chocó")
adjacent("Nariño", "Huila")

adjacent("Cesar", "Atlántico")
adjacent("Cesar", "Santander")
adjacent("Cesar", "Antioquia")

adjacent("Antioquia", "Atlántico")
adjacent("Antioquia", "Cesar")
adjacent("Antioquia", "Santander")
adjacent("Antioquia", "Huila")
adjacent("Antioquia", "Chocó")

adjacent("Santander", "Cesar")
adjacent("Santander", "Arauca")
adjacent("Santander", "Meta East")
adjacent("Santander", "Huila")
adjacent("Santander", "Antioquia")

adjacent("Huila", "Antioquia")
adjacent("Huila", "Santander")
adjacent("Huila", "Meta West")
adjacent("Huila", "Putumayo")
adjacent("Huila", "Nariño")
adjacent("Huila", "Chocó")

adjacent("Arauca", "Vichada")
adjacent("Arauca", "Meta East")
adjacent("Arauca", "Santander")

adjacent("Vichada", "Arauca")
adjacent("Vichada", "Guainía")
adjacent("Vichada", "Guaviare")
adjacent("Vichada", "Meta East")

adjacent("Meta East", "Arauca")
adjacent("Meta East", "Vichada")
adjacent("Meta East", "Guaviare")
adjacent("Meta East", "Meta West")
adjacent("Meta East", "Santander")

adjacent("Meta West", "Meta East")
adjacent("Meta West", "Guaviare")
adjacent("Meta West", "Putumayo")
adjacent("Meta West", "Huila")

adjacent("Putumayo", "Meta West")
adjacent("Putumayo", "Guaviare")
adjacent("Putumayo", "Vaupés")
adjacent("Putumayo", "Amazonas")
adjacent("Putumayo", "Huila")

adjacent("Guaviare", "Meta East")
adjacent("Guaviare", "Vichada")
adjacent("Guaviare", "Guainía")
adjacent("Guaviare", "Vaupés")
adjacent("Guaviare", "Putumayo")
adjacent("Guaviare", "Meta West")

adjacent("Guainía", "Vichada")
adjacent("Guainía", "Vaupés")
adjacent("Guainía", "Guaviare")

adjacent("Vaupés", "Guainía")
adjacent("Vaupés", "Amazonas")
adjacent("Vaupés", "Putumayo")
adjacent("Vaupés", "Guaviare")

adjacent("Amazonas", "Vaupés")
adjacent("Amazonas", "Putumayo")

data.coastal_spaces = [ "Cesar", "Atlántico", "Chocó", "Nariño" ].map(n=>space_name.indexOf(n)).sort((a,b)=>a-b)

for (let i = 1; i < spaces.length; ++i)
	spaces[i].adjacent.sort((a,b)=>a-b)


data.card_name = card_name
data.card_order = card_order
data.space_name = space_name
data.spaces = spaces

let pc_index = 0
let pc_first = data.first_piece = [ [ 0, 0, 0, 0 ], [ 0, 0 ], [ 0, 0 ], [ 0, 0 ] ]
let pc_last = data.last_piece = [ [ -1, -1, -1, -1 ], [ -1, -1 ], [ -1, -1 ], [ -1, -1 ] ]
function def_piece(faction, type, count) {
	pc_first[faction][type] = pc_index
	pc_last[faction][type] = pc_index + count - 1
	pc_index += count
}
def_piece(GOVT, BASE, 3)
def_piece(GOVT, GUERRILLA, 0)
def_piece(GOVT, TROOPS, 30)
def_piece(GOVT, POLICE, 30)
def_piece(FARC, BASE, 9)
def_piece(FARC, GUERRILLA, 30)
def_piece(AUC, BASE, 6)
def_piece(AUC, GUERRILLA, 18)
def_piece(CARTELS, BASE, 15)
def_piece(CARTELS, GUERRILLA, 12)

fs.writeFileSync("data.js", "const data = " + JSON.stringify(data, 0, 0) + "\nif (typeof module !== 'undefined') module.exports = data\n")