aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 14:52:32 -0500
committerHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 14:52:32 -0500
commitd854a9b4f4ce28f166cb01f1ca230c77d103ed23 (patch)
tree59c41960458e37910e492dedc8aaa6a5cb4fa27e
parent9ae02ad2c2676a5991c6c952952fc6fcfdb96304 (diff)
major search.block cleanup
-rw-r--r--examples/search.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/examples/search.js b/examples/search.js
index 73f29d0..a1dcc7c 100644
--- a/examples/search.js
+++ b/examples/search.js
@@ -48,11 +48,23 @@ function Search(searchBlock){ // searchBlock should be a Space object.
// until sort[ind][inds[ind]][ind] != sort[ind][otherind][ind].
// on each, if sort[ind][otherind][1-ind] == sort[ind][inds[ind]][1-ind],
// add to adjacent and search it with exclude=adjacent. Add that to adjacent
- let addr = inds[ind];
+ let sort = this.sort[ind];
+ let chkind = inds[ind];
+ [-1, 1].forEach( sgn => {
+ let curind = chkind + sgn;
+ while (sort[curind] && sort[chkind][ind] == sort[curind][ind]){
+ if (! exclude.has(sort[curind])){
+ adjacent.add(...this.block(sort[curind], [curind, bs(sort, sort[curind], getComp(1-ind))], adjacent));
+ }
+ curind += sgn;
+ }
+ });
+ /*let thisaddr = this.sort[ind][inds[ind]];
for (let i = -1; i <= 1; i+=2) for (let j = 1; this.sort[ind][inds[ind]+i*j] && this.sort[ind][inds[ind]][ind] == this.sort[ind][inds[ind]+i*j][ind]; j++){
+ let otheraddr = this.sort[ind][inds[ind]+i*j];
if (! exclude.has(this.sort[ind][inds[ind]]) && this.sort[ind][inds[ind]][1-ind] == this.sort[inds[ind]+i*j][1-ind]){ // Make more readable
adjacent.add(...this.block(this.sort[ind][inds[ind]+i*j], inds[ind+i*j], exclude=adjacent)); // Already includes itself
- }}
+ }}*/
});
return adjacent;
}