From 4f0d9c6e6397603dca10c30caa1ad3ce65722a83 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 21 Oct 2024 20:47:08 +0200 Subject: renumber minor powers at end. --- play.js | 149 +++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 71 insertions(+), 78 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index 89880e6..5c4539e 100644 --- a/play.js +++ b/play.js @@ -42,17 +42,14 @@ const suit_class = [ "spades", "clubs", "hearts", "diamonds", "reserve" ] const suit_letter = [ "S", "C", "H", "D", "R" ] const P_FRANCE = 0 -const P_BAVARIA = 1 -const P_PRUSSIA = 2 -const P_SAXONY = 3 -const P_PRAGMATIC = 4 -const P_AUSTRIA = 5 +const P_PRUSSIA = 1 +const P_PRAGMATIC = 2 +const P_AUSTRIA = 3 +const P_BAVARIA = 4 +const P_SAXONY = 5 -const power_name = [ "France", "Bavaria", "Prussia", "Saxony", "Pragmatic Army", "Austria" ] -const power_class = [ "france", "bavaria", "prussia", "saxony", "pragmatic", "austria" ] - -const is_major_power = [ 1, 0, 1, 0, 1, 1 ] -const is_minor_power = [ 0, 1, 0, 1, 0, 0 ] +const power_name = [ "France", "Prussia", "Pragmatic Army", "Austria", "Bavaria", "Saxony" ] +const power_class = [ "france", "prussia", "pragmatic", "austria", "bavaria", "saxony" ] const SPADES = 0 const CLUBS = 1 @@ -68,20 +65,20 @@ const all_powers = [ 0, 1, 2, 3, 4, 5 ] const all_power_generals = [ [ 0, 1, 2, 3, 4 ], - [ 5 ], - [ 6, 7, 8, 9 ], - [ 10 ], - [ 11, 12, 13 ], - [ 14, 15, 16, 17, 18, 19 ], + [ 5, 6, 7, 8 ], + [ 9, 10, 11 ], + [ 12, 13, 14, 15, 16, 17 ], + [ 18 ], + [ 19 ], ] const all_power_trains = [ [ 20, 21 ], - [ 22 ], - [ 23, 24 ], - [ 25 ], - [ 26 ], - [ 27, 28, 29 ], + [ 22, 23 ], + [ 24 ], + [ 25, 26, 27 ], + [ 28 ], + [ 29 ], ] const last_piece = 29 @@ -90,36 +87,36 @@ const all_hussars = [ 30, 31 ] const piece_power = [ P_FRANCE, P_FRANCE, P_FRANCE, P_FRANCE, P_FRANCE, - P_BAVARIA, P_PRUSSIA, P_PRUSSIA, P_PRUSSIA, P_PRUSSIA, - P_SAXONY, P_PRAGMATIC, P_PRAGMATIC, P_PRAGMATIC, P_AUSTRIA, P_AUSTRIA, P_AUSTRIA, P_AUSTRIA, P_AUSTRIA, P_AUSTRIA, - P_FRANCE, P_FRANCE, P_BAVARIA, - P_PRUSSIA, P_PRUSSIA, P_SAXONY, + P_FRANCE, P_FRANCE, + P_PRUSSIA, P_PRUSSIA, P_PRAGMATIC, P_AUSTRIA, P_AUSTRIA, P_AUSTRIA, + P_BAVARIA, + P_SAXONY, P_AUSTRIA, P_AUSTRIA ] const piece_rank = [ 1, 2, 3, 4, 5, - 1, 1, 2, 3, 4, - 1, 1, 2, 3, 1, 2, 3, 4, 5, 6, + 1, + 1, ] const piece_abbr = [ "F1", "F2", "F3", "F4", "F5", - "B1", "P1", "P2", "P3", "P4", - "S1", "PA1", "PA2", "PA3", "A1", "A2", "A3", "A4", "A5", "A6", + "B1", + "S1", ] const piece_name = [ @@ -128,12 +125,10 @@ const piece_name = [ "Broglie", "Maillebois", "Noailles", - "Törring", "Friedrich", "Schwerin", "Leopold", "Dessauer", - "Rutowski", "George II", "Cumberland", "Earl of Stair", @@ -143,12 +138,14 @@ const piece_name = [ "Batthyány", "Neipperg", "Arenberg", + "Törring", + "Rutowski", "supply train", "supply train", - "supply train", "supply train", "supply train", "supply train", - "supply train", "supply train", "supply train", "supply train", + "supply train", + "supply train", "hussar", "hussar", ] @@ -158,12 +155,10 @@ const piece_log_name = [ "Broglie", "Maillebois", "Noailles", - "Törring", "Friedrich", "Schwerin", "Leopold", "Dessauer", - "Rutowski", "George II", "Cumberland", "Earl of Stair", @@ -173,21 +168,17 @@ const piece_log_name = [ "Batthyány", "Neipperg", "Arenberg", + "Törring", + "Rutowski", "French ST", "French ST", - "Bavarian ST", "Prussian ST", "Prussian ST", - "Saxon ST", "Pragmatic Army ST", "Austrian ST", "Austrian ST", "Austrian ST", + "Bavarian ST", + "Saxon ST", "Hussars", "Hussars", ] - -const all_pieces = [ ...all_power_generals.flat(), ...all_power_trains.flat() ] -const all_trains = [ ...all_power_trains.flat() ] -const all_generals = [ ...all_power_generals.flat() ] -const all_generals_by_rank = all_generals.slice().sort((a,b)=>piece_rank[a]-piece_rank[b]) - function to_deck(c) { return c >> 7 } @@ -288,12 +279,12 @@ function hide_move_path() { /* PANEL ORDER */ -const panel_order = [ P_FRANCE, P_BAVARIA, P_PRUSSIA, P_SAXONY, P_PRAGMATIC, P_AUSTRIA, P_AUSTRIA+1 ] +const panel_order = [ P_FRANCE, P_BAVARIA, P_PRUSSIA, P_SAXONY, P_PRAGMATIC, P_AUSTRIA, 6 ] const panel_start = { - "Observer": P_FRANCE, - "Louis XV": P_FRANCE, - "Frederick": P_PRUSSIA, - "Maria Theresa": P_AUSTRIA, + "Observer": 0, + "Louis XV": 0, + "Frederick": 2, + "Maria Theresa": 5, } function remember_position(e) { @@ -368,29 +359,29 @@ const ui = { power_panel_list: document.getElementById("power_panel_list"), power_header: [ document.getElementById("hand_france_header"), - document.getElementById("hand_bavaria_header"), document.getElementById("hand_prussia_header"), - document.getElementById("hand_saxony_header"), document.getElementById("hand_pragmatic_header"), document.getElementById("hand_austria_header"), + document.getElementById("hand_bavaria_header"), + document.getElementById("hand_saxony_header"), document.getElementById("political_header"), ], power_panel: [ document.getElementById("hand_france_panel"), - document.getElementById("hand_bavaria_panel"), document.getElementById("hand_prussia_panel"), - document.getElementById("hand_saxony_panel"), document.getElementById("hand_pragmatic_panel"), document.getElementById("hand_austria_panel"), + document.getElementById("hand_bavaria_panel"), + document.getElementById("hand_saxony_panel"), document.getElementById("political_panel"), ], hand: [ document.getElementById("hand_france"), - document.getElementById("hand_bavaria"), document.getElementById("hand_prussia"), - document.getElementById("hand_saxony"), document.getElementById("hand_pragmatic"), document.getElementById("hand_austria"), + document.getElementById("hand_bavaria"), + document.getElementById("hand_saxony"), ], cities: [], roads: [], @@ -502,36 +493,38 @@ function on_init() { create_piece("piece", 2, "piece cylinder france france_3"), create_piece("piece", 3, "piece cylinder france france_4"), create_piece("piece", 4, "piece cylinder france france_5"), - create_piece("piece", 5, "piece cylinder bavaria bavaria_1"), - - create_piece("piece", 6, "piece cylinder prussia prussia_1"), - create_piece("piece", 7, "piece cylinder prussia prussia_2"), - create_piece("piece", 8, "piece cylinder prussia prussia_3"), - create_piece("piece", 9, "piece cylinder prussia prussia_4"), - create_piece("piece", 10, "piece cylinder saxony saxony_1"), - create_piece("piece", 11, "piece cylinder pragmatic pragmatic_1"), - create_piece("piece", 12, "piece cylinder pragmatic pragmatic_2"), - create_piece("piece", 13, "piece cylinder pragmatic pragmatic_3"), - - create_piece("piece", 14, "piece cylinder austria austria_1"), - create_piece("piece", 15, "piece cylinder austria austria_2"), - create_piece("piece", 16, "piece cylinder austria austria_3"), - create_piece("piece", 17, "piece cylinder austria austria_4"), - create_piece("piece", 18, "piece cylinder austria austria_5"), - create_piece("piece", 19, "piece cylinder austria austria_6"), + + create_piece("piece", 5, "piece cylinder prussia prussia_1"), + create_piece("piece", 6, "piece cylinder prussia prussia_2"), + create_piece("piece", 7, "piece cylinder prussia prussia_3"), + create_piece("piece", 8, "piece cylinder prussia prussia_4"), + create_piece("piece", 9, "piece cylinder pragmatic pragmatic_1"), + create_piece("piece", 10, "piece cylinder pragmatic pragmatic_2"), + create_piece("piece", 11, "piece cylinder pragmatic pragmatic_3"), + + create_piece("piece", 12, "piece cylinder austria austria_1"), + create_piece("piece", 13, "piece cylinder austria austria_2"), + create_piece("piece", 14, "piece cylinder austria austria_3"), + create_piece("piece", 15, "piece cylinder austria austria_4"), + create_piece("piece", 16, "piece cylinder austria austria_5"), + create_piece("piece", 17, "piece cylinder austria austria_6"), + + create_piece("piece", 18, "piece cylinder bavaria bavaria_1"), + create_piece("piece", 19, "piece cylinder saxony saxony_1"), create_piece("piece", 20, "piece cube france"), create_piece("piece", 21, "piece cube france"), - create_piece("piece", 22, "piece cube bavaria"), + create_piece("piece", 22, "piece cube prussia"), create_piece("piece", 23, "piece cube prussia"), - create_piece("piece", 24, "piece cube prussia"), - create_piece("piece", 25, "piece cube saxony"), - create_piece("piece", 26, "piece cube pragmatic"), + create_piece("piece", 24, "piece cube pragmatic"), + create_piece("piece", 25, "piece cube austria"), + create_piece("piece", 26, "piece cube austria"), create_piece("piece", 27, "piece cube austria"), - create_piece("piece", 28, "piece cube austria"), - create_piece("piece", 29, "piece cube austria"), + + create_piece("piece", 28, "piece cube bavaria"), + create_piece("piece", 29, "piece cube saxony"), create_piece("piece", 30, "piece disc austria"), create_piece("piece", 31, "piece disc austria"), @@ -543,8 +536,8 @@ function on_init() { for (let e of ui.troops) ui.pieces_element.appendChild(e) - ui.victory = [ [], [], [], [], [], [] ] - ui.retro = [ [], [], [], [], [], [] ] + ui.victory = [ [], [], [], [] ] + ui.retro = [ [], [], [], [] ] for (let pow of [ P_FRANCE, P_PRUSSIA, P_PRAGMATIC, P_AUSTRIA ]) { ui.victory[pow] = [] ui.retro[pow] = [] -- cgit v1.2.3