From d854a9b4f4ce28f166cb01f1ca230c77d103ed23 Mon Sep 17 00:00:00 2001
From: Holden Rohrer <holden.rohrer@gmail.com>
Date: Fri, 27 Dec 2019 14:52:32 -0500
Subject: major search.block cleanup

---
 examples/search.js | 16 ++++++++++++++--
 1 file 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;
   }
-- 
cgit