summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-01 18:32:11 +0200
committerTor Andersson <tor@ccxvii.net>2024-05-01 18:43:40 +0200
commit708b21aea1d82ff88c4fd857badbe742837c28ec (patch)
treef4c07f7193fb409befa6309523a2502f087fc05c /tools
parent687e35cda69c6db8454ad4860cdc9e1df7b39d75 (diff)
downloadplantagenet-708b21aea1d82ff88c4fd857badbe742837c28ec.tar.gz
ravine
Diffstat (limited to 'tools')
-rw-r--r--tools/engage.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/engage.js b/tools/engage.js
index 5b5ed90..4441fa8 100644
--- a/tools/engage.js
+++ b/tools/engage.js
@@ -120,12 +120,21 @@ function make_engagement(array, choice) {
const ENGAGEMENTS = []
const CHOICE = []
-function run(bits, array) {
+function pack_battle_array(filled) {
+ let bits = 0
+ for (let p = 0; p < 6; ++p)
+ if (filled[p])
+ bits |= (1 << p)
+ return bits
+}
+
+function run(array) {
console.log("<tr>")
console.log("<td>")
show_array(array)
console.log("<td>")
let eng = make_engagement(array, 0)
+ let bits = pack_battle_array(array)
ENGAGEMENTS[bits] = eng
if (!eng) {
let eng_a = make_engagement(array, 1)
@@ -138,7 +147,7 @@ function run(bits, array) {
function runall() {
for (let x = 0; x < 64; ++x) {
if ((x & 7) && (x & 56))
- run(x, [ (x>>5)&1, (x>>4)&1, (x>>3)&1, (x>>2)&1, (x>>1)&1, (x>>0)&1 ])
+ run([ (x>>5)&1, (x>>4)&1, (x>>3)&1, (x>>2)&1, (x>>1)&1, (x>>0)&1 ])
}
}