summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js83
1 files changed, 83 insertions, 0 deletions
diff --git a/rules.js b/rules.js
new file mode 100644
index 0000000..4b6c57d
--- /dev/null
+++ b/rules.js
@@ -0,0 +1,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
+} \ No newline at end of file