summaryrefslogtreecommitdiff
path: root/rules.js
blob: 918ec81ca83ff4d9994b49013bcecf518cb1a65a (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
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
"use strict"

let states = {}
let game = null
let view = null

/* DATA */
const data = require("./data.js")
const space_name = data.space_name

function get_space_id(name) {
	return space_name.indexOf(name);
}

const S_ANDHRA = get_space_id("Andhra")
const S_BENGAL = get_space_id("Bengal")
const S_GONDWANA = get_space_id("Gondwana")
const S_GUJARAT = get_space_id("Gujarat")
const S_JAUNPUR = get_space_id("Jaunpur")
const S_KARNATAKA = get_space_id("Karnataka")
const S_MADHYADESH = get_space_id("Madhyadesh")
const S_MAHARASHTRA = get_space_id("Maharashtra")
const S_MALWA = get_space_id("Malwa")
const S_ORISSA = get_space_id("Orissa")
const S_RAJPUT_KINGDOMS = get_space_id("Rajput Kingdoms")
const S_SINDH = get_space_id("Sindh")
const S_TAMILAKAM = get_space_id("Tamilakam")
const S_DELHI = get_space_id("Delhi")
const S_MOUNTAIN_PASSES = get_space_id("Mountain Passes")
const S_PUNJAB = get_space_id("Punjab")
const S_MONGOL_INVADERS = 16
const S_DS_AVAILABLE = 17
const S_BK_AVAILABLE = 18
const S_VE_AVAILABLE = 19
const S_BK_INF_2 = 20
const S_BK_INF_4 = 21
const S_VE_INF_1 = 22
const S_VE_INF_2 = 23
const S_VE_INF_3 = 24
const S_VE_INF_4 = 25


const faction_name = [ "Delhi Sultanate", "Bahmani Kingdom", "Vijayanagara Empire", "Mongol Invaders" ]

exports.scenarios = [ "Standard", "Solo" ]

exports.roles = function (scenario, _options) {
	if (scenario === "Solo")
		return [ NAME_SOLO ]
	return [ NAME_DS, NAME_BK, NAME_VE ]
}

function is_current_role(role) {
	if (role === NAME_SOLO) return true
	if (role === NAME_DS) return game.current === DS
	if (role === NAME_BK) return game.current === BK
	if (role === NAME_VE) return game.current === VE
	return false
}

function load_game(state) {
	game = state
}

function save_game() {
	if (game.solo) {
		game.active = NAME_SOLO
		return game
	}
	if (game.current === DS)
		game.active = NAME_DS
	if (game.current === BK)
		game.active = NAME_BK
	if (game.current === VE)
		game.active = NAME_VE
	return game
}

exports.view = function (state, role) {
	load_game(state)

	let this_card = game.deck[0] | 0
	let deck_size = Math.max(0, game.deck.length - 1)

	view = {
		prompt: null,
		actions: null,
		log: game.log,
		current: game.current,
		vp: game.vp,
		resources: game.resources,
		bk_inf: 0,
		ve_inf: 0,
		deck: [ this_card, deck_size, game.of_gods_and_kings ],
		cylinder: game.cylinder,
		pieces: game.pieces,
	}

	if (game.result) {
		view.prompt = game.victory
	} else if (!is_current_role(role)) {
		let inactive = states[game.state].inactive
		if (!inactive) {
			if (game.vm)
				inactive = "Event"
			else
				inactive = game.state
		}
		view.prompt = `Waiting for ${faction_name[game.current]} \u2014 ${inactive}.`
	} else {
		view.actions = {}

		if (states[game.state])
			states[game.state].prompt()
		else
			view.prompt = "Unknown state: " + game.state

		if (states[game.state] && !states[game.state].disable_negotiation) {
			view.actions.ask_resources = 1
			if (game.resources[game.current] > 0)
				view.actions.transfer_resources = 1
			else
				view.actions.transfer_resources = 0
			if (game.cavalry[game.current] > 0)
				view.actions.transfer_cavalry = 1
			else
				view.actions.transfer_cavalry = 0
			if (true) // TODO: can_ask_cavalry()
				view.actions.ask_cavalry = 1
			else
				view.actions.ask_cavalry = 0
		}

		if (view.actions.undo === undefined) {
			if (game.undo && game.undo.length > 0)
				view.actions.undo = 1
			else
				view.actions.undo = 0
		}
	}

	save_game()
	return view
}

exports.action = function (state, role, action, arg) {
	load_game(state)
	let S = states[game.state]
	if (S && action in S) {
		S[action](arg)
	} else {
		if (action === "undo" && game.undo && game.undo.length > 0)
			pop_undo()
		else if (action === "ask_resources")
			action_ask_resources()
		else if (action === "ask_cavalry")
			action_ask_cavalry()
		else if (action === "transfer_resources")
			action_transfer_resources()
		else if (action === "transfer_cavalry")
			action_transfer_cavalry()
		else
			throw new Error("Invalid action: " + action)
	}
	return save_game()
}

/* SETUP */

exports.setup = function (seed, scenario, _options) {
	game = {
		seed,
		log: [],
		undo: [],
		active: null,
		current: 0,
		state: null,
		cylinder: [ ELIGIBLE, ELIGIBLE, ELIGIBLE ],
		resources: [ 12, 6, 7 ],
		vp: [ 18, 0, 0 ],
		bk_inf: 0,
		ve_inf: 0,
		tributary: 8191, // all 13 provinces
		rebel: 0, // amir/raja rebel status
		pieces: Array(104).fill(AVAILABLE), // piece locations
		deck: [],
	}

	if (scenario === "Solo")
		game.solo = 1

	// TODO: setup start pieces

	// goto_card()

	game.current = DS
	game.state = "todo"

	// Setup
	setup_standard()

	setup_deck()

	goto_card()

	return save_game()
}

function setup_deck() {
	game.deck = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ]
}

function setup_standard() {
	setup_piece(DS, DISC, 1, S_ANDHRA)
	setup_piece(DS, ELITE, 1, S_MALWA)
	setup_piece(DS, TROOPS, 4, S_DELHI)
	setup_piece(DS, TROOPS, 4, S_PUNJAB)
	setup_piece(DS, TROOPS, 3, S_MALWA)
	setup_piece(DS, TROOPS, 2, S_JAUNPUR)
	setup_piece(DS, TROOPS, 2, S_MADHYADESH)
	setup_piece(DS, TROOPS, 2, S_MOUNTAIN_PASSES)
	setup_piece(DS, TROOPS, 1, S_ANDHRA)
	setup_piece(DS, TROOPS, 1, S_GUJARAT)
	setup_piece(DS, TROOPS, 1, S_RAJPUT_KINGDOMS)
	setup_piece(DS, TROOPS, 1, S_SINDH)
	setup_piece(DS, TROOPS, 1, S_TAMILAKAM)

	setup_piece(BK, ELITE, 1, S_GONDWANA)
	setup_piece(BK, ELITE, 1, S_GUJARAT)
	setup_piece(BK, ELITE, 2, S_MADHYADESH)
	setup_piece(BK, ELITE, 4, S_MAHARASHTRA)
	setup_piece(BK, ELITE, 2, S_BK_INF_2)
	setup_piece(BK, ELITE, 2, S_BK_INF_4)

	setup_piece(VE, ELITE, 1, S_TAMILAKAM)
	setup_piece(VE, ELITE, 2, S_ANDHRA)
	setup_piece(VE, ELITE, 3, S_KARNATAKA)
	setup_piece(VE, ELITE, 2, S_VE_INF_1)
	setup_piece(VE, ELITE, 2, S_VE_INF_2)
	setup_piece(VE, ELITE, 2, S_VE_INF_3)
	setup_piece(VE, ELITE, 2, S_VE_INF_4)
}

function setup_piece(faction, type, count, where) {
	for (let p = data.first_piece[faction][type]; count > 0; ++p) {
		if (piece_space(p) < 0) {
			set_piece_space(p, where)
			--count
		}
	}
}


// === SEQUENCE OF PLAY ===

function this_card() {
	return game.deck[0]
}

function goto_card() {
	log_h1("C" + this_card())
	if (this_card() === "todo")
		console.log("todo")
	else
		resume_event_card()
}

function resume_event_card() {
	clear_undo()
	let did_1st = (did_option(SOP_COMMAND_DECREE) || did_option(SOP_EVENT_OR_COMMAND))
	let did_2nd = (did_option(SOP_COMMAND_DECREE) || did_option(SOP_EVENT_OR_COMMAND))
	if (did_1st && did_2nd)
		end_card()
	else
		goto_eligible()
}

function end_card() {
	clear_undo()

	adjust_eligibility(DS)
	adjust_eligibility(BK)
	adjust_eligibility(VE)

	array_remove(game.deck, 0)
	goto_card()
}

function goto_eligible() {
	game.current = next_eligible_faction()
	if (game.current < 0) {
		end_card()
	} else {
		game.state = "eligible"
		game.op = {
			limited: 0,
			free: 0,
			spaces: [],
			where: -1,
			pass: 1
		}
	}
}

function is_eligible(faction) {
	return game.cylinder[faction] === ELIGIBLE
}

function did_option(e) {
	return (
		game.cylinder[DS] === e ||
		game.cylinder[BK] === e ||
		game.cylinder[VE] === e
	)
}

function next_eligible_faction() {
	let order = data.card_order[this_card()]
	for (let faction of order)
		if (is_eligible(faction))
			return faction
	return -1
}

function adjust_eligibility(faction) {
	if (game.cylinder[faction] === INELIGIBLE || game.cylinder[faction] === SOP_PASS || game.cylinder[faction] === SOP_LIMITED_COMMAND)
		game.cylinder[faction] = ELIGIBLE
	else if (game.cylinder[faction] !== ELIGIBLE)
		game.cylinder[faction] = INELIGIBLE
}

function goto_pass() {
	push_undo()

	game.op = 0
	game.sa = 0

	game.cylinder[game.current] = SOP_PASS
	log_h2(faction_name[game.current] + " - Pass")
	if (game.current === DS) {
		log_resources(game.current, 3)
		add_resources(game.current, 3)
	} else {
		log_resources(game.current, 1)
		add_resources(game.current, 1)
	}
	resume_event_card()
}

/* STATES */

states.eligible = {
	disable_negotiation: true,
	inactive: "Eligible Faction",
	prompt() {
		if (did_option(SOP_COMMAND_DECREE)) {
			view.prompt = `${data.card_title[this_card()]}: Event or Command.`
		} else if (did_option(SOP_EVENT_OR_COMMAND)) {
			view.prompt = `${data.card_title[this_card()]}: Command & Decree.`
		} else {
			view.prompt = `${data.card_title[this_card()]}: Event or Command & Decree.`
		}
		view.actions.pass = 1
	},
	pass: goto_pass,
}

/* UTILS */

function add_resources(faction, n) {
	game.resources[faction] = Math.max(0, Math.min(24, game.resources[faction] + n))
}


/* LOGGING */

function log(msg) {
	game.log.push(msg)
}

function logi(msg) {
	log(">" + msg)
}

function log_br() {
	if (game.log.length > 0 && game.log[game.log.length - 1] !== "")
		game.log.push("")
}

function log_h1(msg) {
	log_br()
	log(".h1 " + msg)
	log_br()
}

function log_h2(msg) {
	log_br()
	log(".h2 " + msg)
	log_br()
}

function log_action(msg) {
	log_br()
	log(msg)
}

function log_transfer(msg) {
	log_br()
	log(".n " + msg)
	log_br()
}

function log_transfer_resources(from, to, n) {
	log_transfer(`${faction_name[from]} gave ${n} Resources to ${faction_name[to]}.`)
}

function log_space(s, action) {
	if (action)
		log_action("S" + s + " - " + action)
	else
		log_action("S" + s)
}

function push_summary() {
	if (game.summary)
		throw "TOO MANY SUMMARIES"
	game.summary = []
}

function log_summary(msg) {
	for (let item of game.summary) {
		if (item[1] === msg) {
			item[0]++
			return
		}
	}
	game.summary.push([1, msg])
}

function pop_summary() {
	if (game.summary.length > 0) {
		for (let [n, msg] of game.summary) {
			log(">" + msg.replace("%", String(n)))
		}
	} else {
		log(">Nothing")
	}
	game.summary = null
}

function log_summary_place(p) {
	let from = piece_space(p)
	if (from !== AVAILABLE)
		log_summary("% " + piece_name(p) + " from S" + from)
	else
		log_summary("% " + piece_name(p))
}

function log_summary_move_to_from(p, to) {
	log_summary("% " + piece_name(p) + " to S" + to + " from S" + piece_space(p))
}

function log_summary_remove(p) {
	log_summary("Removed % " + piece_name(p))
}

function log_resources(faction, n) {
	if (n > 0)
		log(faction_name[faction] + " Resources +" + n + ".")
	else
		log(faction_name[faction] + " Resources " + n + ".")
}

// === MISC PIECE QUERIES ===

function piece_space(p) {
	return game.pieces[p]
}

function set_piece_space(p, s) {
	game.pieces[p] = s
}


/* COMMON LIBRARY */

function clear_undo() {
	if (game.undo) {
		game.undo.length = 0
	}
}

function push_undo() {
	if (game.undo) {
		let copy = {}
		for (let k in game) {
			let v = game[k]
			if (k === "undo")
				continue
			else if (k === "log")
				v = v.length
			else if (typeof v === "object" && v !== null)
				v = object_copy(v)
			copy[k] = v
		}
		game.undo.push(copy)
	}
}

function pop_undo() {
	if (game.undo) {
		let save_log = game.log
		let save_undo = game.undo
		game = save_undo.pop()
		save_log.length = game.log
		game.log = save_log
		game.undo = save_undo
	}
}

function random(range) {
	// An MLCG using integer arithmetic with doubles.
	// https://www.ams.org/journals/mcom/1999-68-225/S0025-5718-99-00996-5/S0025-5718-99-00996-5.pdf
	// m = 2**35 − 31
	return (game.seed = game.seed * 200105 % 34359738337) % range
}

function random_bigint(range) {
	// Largest MLCG that will fit its state in a double.
	// Uses BigInt for arithmetic, so is an order of magnitude slower.
	// https://www.ams.org/journals/mcom/1999-68-225/S0025-5718-99-00996-5/S0025-5718-99-00996-5.pdf
	// m = 2**53 - 111
	return (game.seed = Number(BigInt(game.seed) * 5667072534355537n % 9007199254740881n)) % range
}

function shuffle(list) {
	// Fisher-Yates shuffle
	for (let i = list.length - 1; i > 0; --i) {
		let j = random(i + 1)
		let tmp = list[j]
		list[j] = list[i]
		list[i] = tmp
	}
}

function shuffle_bigint(list) {
	// Fisher-Yates shuffle
	for (let i = list.length - 1; i > 0; --i) {
		let j = random_bigint(i + 1)
		let tmp = list[j]
		list[j] = list[i]
		list[i] = tmp
	}
}

// Fast deep copy for objects without cycles
function object_copy(original) {
	if (Array.isArray(original)) {
		let n = original.length
		let copy = new Array(n)
		for (let i = 0; i < n; ++i) {
			let v = original[i]
			if (typeof v === "object" && v !== null)
				copy[i] = object_copy(v)
			else
				copy[i] = v
		}
		return copy
	} else {
		let copy = {}
		for (let i in original) {
			let v = original[i]
			if (typeof v === "object" && v !== null)
				copy[i] = object_copy(v)
			else
				copy[i] = v
		}
		return copy
	}
}

// Array remove and insert (faster than splice)

function array_remove(array, index) {
	let n = array.length
	for (let i = index + 1; i < n; ++i)
		array[i - 1] = array[i]
	array.length = n - 1
}

function array_remove_item(array, item) {
	let n = array.length
	for (let i = 0; i < n; ++i)
		if (array[i] === item)
			return array_remove(array, i)
}

function array_insert(array, index, item) {
	for (let i = array.length; i > index; --i)
		array[i] = array[i - 1]
	array[index] = item
}

function array_remove_pair(array, index) {
	let n = array.length
	for (let i = index + 2; i < n; ++i)
		array[i - 2] = array[i]
	array.length = n - 2
}

function array_insert_pair(array, index, key, value) {
	for (let i = array.length; i > index; i -= 2) {
		array[i] = array[i-2]
		array[i+1] = array[i-1]
	}
	array[index] = key
	array[index+1] = value
}

// Set as plain sorted array

function set_clear(set) {
	set.length = 0
}

function set_has(set, item) {
	let a = 0
	let b = set.length - 1
	while (a <= b) {
		let m = (a + b) >> 1
		let x = set[m]
		if (item < x)
			b = m - 1
		else if (item > x)
			a = m + 1
		else
			return true
	}
	return false
}

function set_add(set, item) {
	let a = 0
	let b = set.length - 1
	while (a <= b) {
		let m = (a + b) >> 1
		let x = set[m]
		if (item < x)
			b = m - 1
		else if (item > x)
			a = m + 1
		else
			return
	}
	array_insert(set, a, item)
}

function set_delete(set, item) {
	let a = 0
	let b = set.length - 1
	while (a <= b) {
		let m = (a + b) >> 1
		let x = set[m]
		if (item < x)
			b = m - 1
		else if (item > x)
			a = m + 1
		else {
			array_remove(set, m)
			return
		}
	}
}

function set_toggle(set, item) {
	let a = 0
	let b = set.length - 1
	while (a <= b) {
		let m = (a + b) >> 1
		let x = set[m]
		if (item < x)
			b = m - 1
		else if (item > x)
			a = m + 1
		else {
			array_remove(set, m)
			return
		}
	}
	array_insert(set, a, item)
}

// Map as plain sorted array of key/value pairs

function map_clear(map) {
	map.length = 0
}

function map_has(map, key) {
	let a = 0
	let b = (map.length >> 1) - 1
	while (a <= b) {
		let m = (a + b) >> 1
		let x = map[m<<1]
		if (key < x)
			b = m - 1
		else if (key > x)
			a = m + 1
		else
			return true
	}
	return false
}

function map_get(map, key, missing) {
	let a = 0
	let b = (map.length >> 1) - 1
	while (a <= b) {
		let m = (a + b) >> 1
		let x = map[m<<1]
		if (key < x)
			b = m - 1
		else if (key > x)
			a = m + 1
		else
			return map[(m<<1)+1]
	}
	return missing
}

function map_set(map, key, value) {
	let a = 0
	let b = (map.length >> 1) - 1
	while (a <= b) {
		let m = (a + b) >> 1
		let x = map[m<<1]
		if (key < x)
			b = m - 1
		else if (key > x)
			a = m + 1
		else {
			map[(m<<1)+1] = value
			return
		}
	}
	array_insert_pair(map, a<<1, key, value)
}

function map_delete(map, key) {
	let a = 0
	let b = (map.length >> 1) - 1
	while (a <= b) {
		let m = (a + b) >> 1
		let x = map[m<<1]
		if (key < x)
			b = m - 1
		else if (key > x)
			a = m + 1
		else {
			array_remove_pair(map, m<<1)
			return
		}
	}
}

function object_diff(a, b) {
	if (a === b)
		return false
	if (a !== null && b !== null && typeof a === "object" && typeof b === "object") {
		if (Array.isArray(a)) {
			if (!Array.isArray(b))
				return true
			let a_length = a.length
			if (b.length !== a_length)
				return true
			for (let i = 0; i < a_length; ++i)
				if (object_diff(a[i], b[i]))
					return true
			return false
		}
		for (let key in a)
			if (object_diff(a[key], b[key]))
				return true
		for (let key in b)
			if (!(key in a))
				return true
		return false
	}
	return true
}

// same as Object.groupBy
function object_group_by(items, callback) {
	let groups = {}
	if (typeof callback === "function") {
		for (let item of items) {
			let key = callback(item)
			if (key in groups)
				groups[key].push(item)
			else
				groups[key] = [ item ]
		}
	} else {
		for (let item of items) {
			let key = item[callback]
			if (key in groups)
				groups[key].push(item)
			else
				groups[key] = [ item ]
		}
	}
	return groups
}


// === CONST ===

// Factions
const DS = 0
const BK = 1
const VE = 2
const MI = 3

// Role names
const NAME_DS = "DS"
const NAME_BK = "BK"
const NAME_VE = "VE"
const NAME_SOLO = "Solo"

// Player pieces types
const DISC = 0
const ELITE = 1
const TROOPS = 2

// Pieces status
const AVAILABLE = -1
const OUT_OF_PLAY = -2
const ANY_PIECES = [ DISC, ELITE, TROOPS ]
const PIECE_FACTION_TYPE_NAME = [
	[ "Qasbah", "Governors", "Troops" ],
	[ "Fort", "Amirs", null ],
	[ "Temple", "Rajas", null ],
	[ null, null, "Invaders"]
]

// Sequence of Play options
const ELIGIBLE = 0
const SOP_LIMITED_COMMAND = 1
const SOP_COMMAND_DECREE = 2
const SOP_EVENT_OR_COMMAND = 3
const SOP_PASS = 4
const INELIGIBLE = 5
// === CONST ===