X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Frsmain.c;h=b3a6d73c6244a07629e270b3c827608a66fe80df;hb=4ed298fb2ac975783ad1a350659f5ae22825e24e;hp=ed21fe88e441cba93ce1c940b99a7fe5585166e5;hpb=2388148ea6c557995767e4391088838946c2f238;p=ypp-sc-tools.web-live.git diff --git a/yarrg/rsmain.c b/yarrg/rsmain.c index ed21fe8..b3a6d73 100644 --- a/yarrg/rsmain.c +++ b/yarrg/rsmain.c @@ -7,6 +7,13 @@ double max_mass=-1, max_volu=-1, max_capi=-1; double distance_loss_factor_per_league; int max_dist= -1; +#define CTR(x) int ctr_##x; + COUNTER_LIST +#undef CTR + +static PotentialResult ****results; + /* results[start_isle_ix][finalisle][midisle]-> */ + int main(int argc, const char **argv) { const char *arg; @@ -39,6 +46,8 @@ int main(int argc, const char **argv) { setup_sql(); setup_value(); setup_search(); + + fprintf(stderr,"setup complete, starting search\n"); arg= *argv++; if (!strcmp(arg,"specific")) { @@ -49,11 +58,80 @@ int main(int argc, const char **argv) { double val= value_route(ni, ia, 0); printf("route value is %g\n", val); } else if (!strcmp(arg,"search")) { + MCALLOC(results, argc); + max_dist= atoi(*argv++); - while ((arg= *argv++)) - search(atoi(arg)); + nhighscores_absolute= atoi(*argv++); + nhighscores_perleague= atoi(*argv++); + + MCALLOC(highscores_absolute, nhighscores_absolute); + MCALLOC(highscores_perleague, nhighscores_perleague); + + int resultsix= 0; + while ((arg= argv[resultsix])) { + search(atoi(arg), &results[resultsix]); + resultsix++; + } + + int i, midarch, finarch; + for (i=0; iabsolute)); + fprintf(stderr," "); + fprintf(stderr,"%4d",(int)(result->perleague)); + } + } + fprintf(stderr,"\n"); + } + } + + int pos; +#define OUT(absperl) \ + fprintf(stderr,"\n================== " #absperl " ==================\n"); \ + for (pos=0; pospr; \ + if (!pr) continue; \ + const int *const ports= pr->absperl##_ports; \ + int nports; \ + for (nports=0; nports=0; nports++); \ + int finisle= ports[nports-1]; int finarch= isle2arch(finisle); \ + int midisle= ports[nports/2]; int midarch= isle2arch(midisle); \ + fprintf(stderr, \ + " @%2d #%2d | start%3d mid %d:%3d f%d:%3d | %5d %5d %4d |", \ + pos, nhighscores_##absperl - 1 - pos, \ + ports[0], midarch,midisle, finarch,finisle, \ + (int)hs->value, (int)pr->absolute, (int)pr->perleague); \ + for (i=0; i