// check whether our distance and tallycounter algorithms work correctly namespace dhrg { void test_paths(int radius) { celllister cl(croot(), radius, 1000000, NULL); int N = isize(cl.lst); printf("N = %d\n", N); vector mycells; for(cell *c: cl.lst) mycells.push_back(find_mycell_by_path(computePath(c))); int ctable[MAXDIST]; for(int u=0; uascell(); if(c != c1) { printf("ascell error %s / %s\n", computePath(c).c_str(), computePath(c1).c_str()); c->item = itEmerald; c1->item = itRuby; errorcount++; return; } } for(int i=0; iitem = itDiamond; cl.lst[j]->item = itSilver; errorcount++; return; } else ctable[a]++; } for(mycell* mc1: mycells) for(mycell* mc2: mycells) { add_to_set(mc1, 1, 0); add_to_tally(mc2, 1, 0); // int v = 0; if(tally[quickdist(mc1, mc2)] != 1) { printf("[%p] [%p]\n", mc1, mc2); printf("quickdist = %d\n", quickdist(mc1, mc2)); for(int i=0; iascell()->item = itDiamond; mc2->ascell()->item = itSilver; errorcount++; add_to_tally(mc2, -1, 0); add_to_set(mc1, -1, 0); return; } add_to_tally(mc2, -1, 0); add_to_set(mc1, -1, 0); } for(mycell* mc: mycells) add_to_set(mc, 1, 0); for(mycell* mc: mycells) add_to_tally(mc, 1, 0); for(int u=0; u