From b957163972977fbceee139fc7e586e7f17b50916 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 8 Dec 2023 11:21:54 +0100 Subject: Inline data.js --- data.js | 2 -- play.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- rules.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- tools/gendata.js | 3 +-- 4 files changed, 107 insertions(+), 6 deletions(-) delete mode 100644 data.js 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)) -- cgit v1.2.3