From 708b21aea1d82ff88c4fd857badbe742837c28ec Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 1 May 2024 18:32:11 +0200 Subject: ravine --- tools/engage.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tools') 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("") console.log("") show_array(array) console.log("") 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 ]) } } -- cgit v1.2.3