From 5d7ea94246761f781b19d919a4ae3a1cd33e0aeb Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 3 Aug 2019 11:34:24 +0200 Subject: [PATCH] binary:: celldistance3_approx works without cells too --- binary-tiling.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/binary-tiling.cpp b/binary-tiling.cpp index 4a1dfa10..a5fe4915 100644 --- a/binary-tiling.cpp +++ b/binary-tiling.cpp @@ -819,8 +819,13 @@ int celldistance3_approx(heptagon *c1, heptagon *c2) { while(true) { if(d > 1000000) return d; /* sanity check */ if(c1 == c2) return d; - if(neighborId(c1->c7, c2->c7) >= 0) return d + 1; - forCellEx(c3, c1->c7) if(neighborId(c3, c2->c7) >= 0) return d + 2; + for(int i=0; itype; i++) + if(c1->move(i) == c2) return d + 1; + for(int i=0; itype; i++) { + heptagon *c3 = c1->move(i); + for(int j=0; jtype; j++) + if(c3->move(j) == c2) return d+2; + } if(c1->distance > c2->distance) c1=c1->cmove(updir()), d++; else c2=c2->cmove(updir()), d++; }