summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.js8
-rw-r--r--play.css37
-rw-r--r--play.html4
-rw-r--r--play.js30
-rw-r--r--rules.js25
5 files changed, 81 insertions, 23 deletions
diff --git a/data.js b/data.js
index 2c8c6b7..4b36e23 100644
--- a/data.js
+++ b/data.js
@@ -23,10 +23,10 @@ data.map = {
streams: [1021,1024,1120,1124,1224,1300,1314,1324,1401,1415,1501,1502,1514,1600,1601,1603,1604,1704,1837,1937,2038,2138,2407,2507,2524,2540,2604,2608,2609,2620,2621,2624,2625,2637,2641,2704,2708,2718,2719,2721,2724,2725,2737,2740,2741,2805,2808,2817,2820,2821,2825,2838,2840,2905,2906,2907,2915,2916,2917,2920,2921,2925,2938,2940,3006,3017,3018,3019,3020,3021,3022,3025,3039,3040,3041,3106,3117,3118,3121,3122,3125,3141,3205,3207,3219,3220,3221,3222,3223,3225,3226,3305,3306,3320,3323,3324,3325,3406,3423,3502,3503,3506,3517,3518,3520,3521,3523,3534,3535,3536,3604,3605,3606,3607,3619,3622,3623,3624,3635,3637,3703,3704,3705,3706,3707,3708,3709,3710,3711,3712,3713,3714,3719,3723,3735,3736,3739,3802,3803,3806,3813,3820,3824,3825,3836,3837,3840,3906,3920,3925,3937,3938,3939,4007,4021,4026,4027,4038,4039],
brussels_couillet_road: [1018,1117,1217,1218,1317,1417,1516,1617,1716,1817,1917,2018,2117,2218,2317,2418,2517,2618,2717,2818,2917,3018,3116,3117,3216,3316,3416,3515,3616,3616,3715,3815,3915,4015],
forbidden: [
- // Forbidden to French: 3000, 4015
- [ 2900, 3000, 3001, 3100, 3914, 3915, 4014, 4015, 4016 ],
- // Forbidden to Coalition: 1015, 1017, 1018, 1020
- [ 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1114, 1115, 1116, 1117, 1120 ],
+ // Forbidden to French:
+ [ 3000, 3241, 4015 ],
+ // Forbidden to Coalition:
+ [ 1015, 1017, 1018, 1020 ],
],
names: {
diff --git a/play.css b/play.css
index 8081f08..04fea9c 100644
--- a/play.css
+++ b/play.css
@@ -54,6 +54,11 @@ main {
box-shadow: 0 0 8px #0008;
}
+#hexes {
+ width: 2550px;
+ height: 1650px;
+}
+
#tracks {
top: 1670px;
left: 20px;
@@ -121,14 +126,34 @@ main {
.hex.a_range { background-color: #b326 !important }
.hex.p_range { background-color: #8286 !important }
-#hexes.p1hq .hex.p1hq { background-color: #05a4 }
-#hexes.p2hq .hex.p2hq { background-color: #b324 }
+#hexes[data-show="1"] .hex.p1hq { background-color: #05a4 }
+#hexes[data-show="1"] .hex.p2hq { background-color: #b324 }
+
+#hexes[data-show="2"] .hex.p1zoi { background-color: #05a4 }
+#hexes[data-show="2"] .hex.p1zoc { background-color: #05a8 }
-#hexes.p1zoc .hex.p1zoi { background-color: #05a4 }
-#hexes.p1zoc .hex.p1zoc { background-color: #05a8 }
+#hexes[data-show="3"] .hex.p2zoi { background-color: #b324 }
+#hexes[data-show="3"] .hex.p2zoc { background-color: #b328 }
+
+#hexes[data-show="4"] .hex.p1forbidden { background-color: #0008 }
+#hexes[data-show="4"] .hex.p2forbidden { background-color: #0008 }
+
+#hexes_show_label {
+ position: absolute;
+ bottom: 2px;
+ left: 1275px;
+ left: 30px;
+ font-size: 18px;
+ font-weight: bold;
+ background-color: #81393a;
+ color: #e7ad65;
+ padding: 0 8px;
+}
-#hexes.p2zoc .hex.p2zoi { background-color: #b324 }
-#hexes.p2zoc .hex.p2zoc { background-color: #b328 }
+#hexes[data-show="1"] #hexes_show_label::after { content: "Overlay - HQ Range" }
+#hexes[data-show="2"] #hexes_show_label::after { content: "Overlay - French ZoC and ZoI" }
+#hexes[data-show="3"] #hexes_show_label::after { content: "Overlay - Coalition ZoC and ZoI" }
+#hexes[data-show="4"] #hexes_show_label::after { content: "Overlay - Forbidden entry hexes" }
.large {
position: absolute;
diff --git a/play.html b/play.html
index f4fb509..076a48a 100644
--- a/play.html
+++ b/play.html
@@ -213,7 +213,9 @@
<div class="label" style="left:1662px;top:309px">Corroy-<br>le Grand</div>
</div>
-<div id="hexes"></div>
+<div id="hexes">
+<div id="hexes_show_label"></div>
+</div>
<div id="pieces">
<div id="marker_turn" class="marker large y1" style="top:1665px;left:53px"></div>
diff --git a/play.js b/play.js
index b4ff74c..9dc7f40 100644
--- a/play.js
+++ b/play.js
@@ -16,6 +16,20 @@ const DICE = {
D6: '<span class="dice d6"></span>',
}
+const FORBIDDEN = [
+ [
+ 2800, 2801, 2900, 2901, 3000, 3001, 3002, 3040, 3041,
+ 3100, 3101, 3139, 3140, 3141, 3200, 3201, 3239, 3240,
+ 3241, 3339, 3340, 3341, 3440, 3441, 3814, 3815, 3816,
+ 3913, 3914, 3915, 3916, 4013, 4014, 4015, 4016, 4017,
+ ],
+ [
+ 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021,
+ 1022, 1114, 1115, 1116, 1117, 1120, 1121, 1215, 1216,
+ 1218, 1221,
+ ],
+]
+
const yoff = 1555
const xoff = 36
const hex_dx = 58.67
@@ -184,6 +198,11 @@ for (let row = 0; row < data.map.rows; ++row) {
else
hex.my_name = String(hex_id)
+ if (set_has(FORBIDDEN[0], hex_id))
+ hex.classList.add("p1forbidden")
+ if (set_has(FORBIDDEN[1], hex_id))
+ hex.classList.add("p2forbidden")
+
document.getElementById("hexes").appendChild(hex)
}
}
@@ -209,16 +228,7 @@ function toggle_pieces() {
function toggle_hexes() {
// Cycle between showing nothing, command ranges, and zocs
let elt = document.getElementById("hexes")
- if (elt.className == "")
- elt.className = "p1hq"
- else if (elt.className == "p1hq")
- elt.className = "p2hq"
- else if (elt.className == "p2hq")
- elt.className = "p1zoc"
- else if (elt.className == "p1zoc")
- elt.className = "p2zoc"
- else if (elt.className == "p2zoc")
- elt.className = ""
+ elt.dataset.show = ((elt.dataset.show|0) + 1) % 5
}
function is_action(action, arg) {
diff --git a/rules.js b/rules.js
index f5367c4..a1782d3 100644
--- a/rules.js
+++ b/rules.js
@@ -26,8 +26,8 @@ const TURN_NAME = [
const last_hex = 1000 + (data.map.rows - 1) * 100 + (data.map.cols - 1)
-const p1_forbidden = data.map.forbidden[0]
-const p2_forbidden = data.map.forbidden[1]
+const p1_forbidden_entry = data.map.forbidden[0]
+const p2_forbidden_entry = data.map.forbidden[1]
var move_seen = new Array(last_hex - 999).fill(0)
var move_cost = new Array(last_hex - 999).fill(0)
@@ -162,6 +162,27 @@ for (let road_id = 0; road_id < data.map.roads.length; ++road_id) {
}
}
+const p1_forbidden = []
+const p2_forbidden = []
+
+function calc_forbidden(set, a) {
+ set_add(set, a)
+ for_each_adjacent(a, b => {
+ if (!is_river(a, b)) {
+ set_add(set, b)
+ for_each_adjacent(b, c => {
+ if (!is_river(b, c))
+ set_add(set, c)
+ })
+ }
+ })
+}
+
+for (let entry of p1_forbidden_entry)
+ calc_forbidden(p1_forbidden, entry)
+for (let entry of p2_forbidden_entry)
+ calc_forbidden(p2_forbidden, entry)
+
function make_piece_list(f) {
let list = []
for (let p = 0; p < data.pieces.length; ++p)