summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-08 11:21:54 +0100
committerTor Andersson <tor@ccxvii.net>2023-12-08 11:23:27 +0100
commitb957163972977fbceee139fc7e586e7f17b50916 (patch)
tree6763e82c8dbbf474b0334266e4f90b5695a5ea46
parent6458bf77fb8b33551a1f44a3d3de4ecd222d2ce6 (diff)
downloadvotes-for-women-b957163972977fbceee139fc7e586e7f17b50916.tar.gz
Inline data.js
-rw-r--r--data.js2
-rw-r--r--play.js55
-rw-r--r--rules.js53
-rw-r--r--tools/gendata.js3
4 files changed, 107 insertions, 6 deletions
diff --git a/data.js b/data.js
deleted file mode 100644
index d4f37a2..0000000
--- a/data.js
+++ /dev/null
@@ -1,2 +0,0 @@
-const US_STATES = [null,{"code":"AZ","name":"Arizona","region":1},{"code":"CA","name":"California","region":1},{"code":"ID","name":"Idaho","region":1},{"code":"NM","name":"New Mexico","region":1},{"code":"NV","name":"Nevada","region":1},{"code":"OR","name":"Oregon","region":1},{"code":"UT","name":"Utah","region":1},{"code":"WA","name":"Washington","region":1},{"code":"CO","name":"Colorado","region":2},{"code":"KS","name":"Kansas","region":2},{"code":"MT","name":"Montana","region":2},{"code":"ND","name":"North Dakota","region":2},{"code":"NE","name":"Nebraska","region":2},{"code":"OK","name":"Oklahoma","region":2},{"code":"SD","name":"South Dakota","region":2},{"code":"WY","name":"Wyoming","region":2},{"code":"AL","name":"Alabama","region":3},{"code":"AR","name":"Arkansas","region":3},{"code":"FL","name":"Florida","region":3},{"code":"GA","name":"Georgia","region":3},{"code":"LA","name":"Louisiana","region":3},{"code":"MS","name":"Mississippi","region":3},{"code":"SC","name":"South Carolina","region":3},{"code":"TX","name":"Texas","region":3},{"code":"IA","name":"Iowa","region":4},{"code":"IL","name":"Illinois","region":4},{"code":"IN","name":"Indiana","region":4},{"code":"MI","name":"Michigan","region":4},{"code":"MN","name":"Minnesota","region":4},{"code":"MO","name":"Missouri","region":4},{"code":"OH","name":"Ohio","region":4},{"code":"WI","name":"Wisconsin","region":4},{"code":"DE","name":"Delaware","region":5},{"code":"KY","name":"Kentucky","region":5},{"code":"MD","name":"Maryland","region":5},{"code":"NC","name":"North Carolina","region":5},{"code":"PA","name":"Pennsylvania","region":5},{"code":"TN","name":"Tennessee","region":5},{"code":"VA","name":"Virginia","region":5},{"code":"WV","name":"West Virginia","region":5},{"code":"CT","name":"Connecticut","region":6},{"code":"MA","name":"Massachusetts","region":6},{"code":"ME","name":"Maine","region":6},{"code":"NH","name":"New Hampshire","region":6},{"code":"NJ","name":"New Jersey","region":6},{"code":"NY","name":"New York","region":6},{"code":"RI","name":"Rhode Island","region":6},{"code":"VT","name":"Vermont","region":6}]
-if (typeof module !== 'undefined') module.exports = { US_STATES }
diff --git a/play.js b/play.js
index 3bb5ed4..97b1ea1 100644
--- a/play.js
+++ b/play.js
@@ -1,6 +1,6 @@
"use strict"
-/* global CARDS, US_STATES, action_button, player, scroll_into_view, send_action, view */
+/* global CARDS, action_button, player, scroll_into_view, send_action, view */
const SUF = 0
const OPP = 1
@@ -17,6 +17,59 @@ const REGION_NAMES = [
"Northeast"
]
+
+const US_STATES = [
+ null,
+ { code: "AZ", name: "Arizona", region: 1 },
+ { code: "CA", name: "California", region: 1 },
+ { code: "ID", name: "Idaho", region: 1 },
+ { code: "NM", name: "New Mexico", region: 1 },
+ { code: "NV", name: "Nevada", region: 1 },
+ { code: "OR", name: "Oregon", region: 1 },
+ { code: "UT", name: "Utah", region: 1 },
+ { code: "WA", name: "Washington", region: 1 },
+ { code: "CO", name: "Colorado", region: 2 },
+ { code: "KS", name: "Kansas", region: 2 },
+ { code: "MT", name: "Montana", region: 2 },
+ { code: "ND", name: "North Dakota", region: 2 },
+ { code: "NE", name: "Nebraska", region: 2 },
+ { code: "OK", name: "Oklahoma", region: 2 },
+ { code: "SD", name: "South Dakota", region: 2 },
+ { code: "WY", name: "Wyoming", region: 2 },
+ { code: "AL", name: "Alabama", region: 3 },
+ { code: "AR", name: "Arkansas", region: 3 },
+ { code: "FL", name: "Florida", region: 3 },
+ { code: "GA", name: "Georgia", region: 3 },
+ { code: "LA", name: "Louisiana", region: 3 },
+ { code: "MS", name: "Mississippi", region: 3 },
+ { code: "SC", name: "South Carolina", region: 3 },
+ { code: "TX", name: "Texas", region: 3 },
+ { code: "IA", name: "Iowa", region: 4 },
+ { code: "IL", name: "Illinois", region: 4 },
+ { code: "IN", name: "Indiana", region: 4 },
+ { code: "MI", name: "Michigan", region: 4 },
+ { code: "MN", name: "Minnesota", region: 4 },
+ { code: "MO", name: "Missouri", region: 4 },
+ { code: "OH", name: "Ohio", region: 4 },
+ { code: "WI", name: "Wisconsin", region: 4 },
+ { code: "DE", name: "Delaware", region: 5 },
+ { code: "KY", name: "Kentucky", region: 5 },
+ { code: "MD", name: "Maryland", region: 5 },
+ { code: "NC", name: "North Carolina", region: 5 },
+ { code: "PA", name: "Pennsylvania", region: 5 },
+ { code: "TN", name: "Tennessee", region: 5 },
+ { code: "VA", name: "Virginia", region: 5 },
+ { code: "WV", name: "West Virginia", region: 5 },
+ { code: "CT", name: "Connecticut", region: 6 },
+ { code: "MA", name: "Massachusetts", region: 6 },
+ { code: "ME", name: "Maine", region: 6 },
+ { code: "NH", name: "New Hampshire", region: 6 },
+ { code: "NJ", name: "New Jersey", region: 6 },
+ { code: "NY", name: "New York", region: 6 },
+ { code: "RI", name: "Rhode Island", region: 6 },
+ { code: "VT", name: "Vermont", region: 6 },
+]
+
const region_count = 6
const us_states_count = region_count * 8
const card_count = 128
diff --git a/rules.js b/rules.js
index 94b6b19..a6f250e 100644
--- a/rules.js
+++ b/rules.js
@@ -65,7 +65,58 @@ const COLOR_NAMES = {
}
const { CARDS } = require("./cards.js")
-const { US_STATES } = require("./data.js")
+
+const US_STATES = [
+ null,
+ { code: "AZ", name: "Arizona", region: 1 },
+ { code: "CA", name: "California", region: 1 },
+ { code: "ID", name: "Idaho", region: 1 },
+ { code: "NM", name: "New Mexico", region: 1 },
+ { code: "NV", name: "Nevada", region: 1 },
+ { code: "OR", name: "Oregon", region: 1 },
+ { code: "UT", name: "Utah", region: 1 },
+ { code: "WA", name: "Washington", region: 1 },
+ { code: "CO", name: "Colorado", region: 2 },
+ { code: "KS", name: "Kansas", region: 2 },
+ { code: "MT", name: "Montana", region: 2 },
+ { code: "ND", name: "North Dakota", region: 2 },
+ { code: "NE", name: "Nebraska", region: 2 },
+ { code: "OK", name: "Oklahoma", region: 2 },
+ { code: "SD", name: "South Dakota", region: 2 },
+ { code: "WY", name: "Wyoming", region: 2 },
+ { code: "AL", name: "Alabama", region: 3 },
+ { code: "AR", name: "Arkansas", region: 3 },
+ { code: "FL", name: "Florida", region: 3 },
+ { code: "GA", name: "Georgia", region: 3 },
+ { code: "LA", name: "Louisiana", region: 3 },
+ { code: "MS", name: "Mississippi", region: 3 },
+ { code: "SC", name: "South Carolina", region: 3 },
+ { code: "TX", name: "Texas", region: 3 },
+ { code: "IA", name: "Iowa", region: 4 },
+ { code: "IL", name: "Illinois", region: 4 },
+ { code: "IN", name: "Indiana", region: 4 },
+ { code: "MI", name: "Michigan", region: 4 },
+ { code: "MN", name: "Minnesota", region: 4 },
+ { code: "MO", name: "Missouri", region: 4 },
+ { code: "OH", name: "Ohio", region: 4 },
+ { code: "WI", name: "Wisconsin", region: 4 },
+ { code: "DE", name: "Delaware", region: 5 },
+ { code: "KY", name: "Kentucky", region: 5 },
+ { code: "MD", name: "Maryland", region: 5 },
+ { code: "NC", name: "North Carolina", region: 5 },
+ { code: "PA", name: "Pennsylvania", region: 5 },
+ { code: "TN", name: "Tennessee", region: 5 },
+ { code: "VA", name: "Virginia", region: 5 },
+ { code: "WV", name: "West Virginia", region: 5 },
+ { code: "CT", name: "Connecticut", region: 6 },
+ { code: "MA", name: "Massachusetts", region: 6 },
+ { code: "ME", name: "Maine", region: 6 },
+ { code: "NH", name: "New Hampshire", region: 6 },
+ { code: "NJ", name: "New Jersey", region: 6 },
+ { code: "NY", name: "New York", region: 6 },
+ { code: "RI", name: "Rhode Island", region: 6 },
+ { code: "VT", name: "Vermont", region: 6 },
+]
function opponent_name() {
if (game.active === SUF) {
diff --git a/tools/gendata.js b/tools/gendata.js
index f08614f..190caec 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -83,5 +83,4 @@ def_us_state("RI", "Rhode Island", NORTHEAST)
def_us_state("VT", "Vermont", NORTHEAST)
console.log("const us_state_count =", US_STATES.length)
-
-fs.writeFileSync("data.js", "const US_STATES = " + JSON.stringify(US_STATES, 0, 0) + "\nif (typeof module !== 'undefined') module.exports = { US_STATES }\n")
+console.log("const US_STATES = " + JSON.stringify(US_STATES, 0, 8))