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
|
"use strict"
var game, view, states = {}
const data = require("./data.js")
const DEM = "Democrat"
const COM = "Communist"
const first_strategy_card = 1
const last_strategy_card = 110 /* to check! */
exports.scenarios = [ "Standard" ]
exports.roles = [ DEM, COM ]
// --- SET UP ---
exports.setup = function (seed, scenario, options) {
game = {
seed: seed,
log: [],
undo: [],
active: null,
state: null,
selected_cards: [],
turn: 0,
round: 0,
strategy_deck: [],
strategy_discard: [],
states_draw: [],
draw_deck: [],
democrat_hand: [],
communist_hand: [],
democrat_set_aside: [],
}
log_h1("1989 Dawn of Freedom")
setup_game()
game.active = COM
start_turn()
return game
}
function setup_game() {
// init card desks & shuffle
}
function init_player_cards(first_card) {
let c = first_card
let deck = []
for (let n = 0; n < era_cards_count; ++n)
deck.push(++c)
shuffle(deck)
return deck
}
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
}
return list
}
|