int o_quiet= 0;
double max_mass=-1, max_volu=-1, max_capi=-1;
double distance_loss_factor_per_league;
-int max_dist= -1;
+int max_dist=-1, min_trade_maxprofit=0;
FILE *debug_file;
FILE *output;
#undef CTR
#undef CTRA
-static PotentialResult ****results[GRANUS];
+static Bucket ****results[GRANUS];
/* results[GRANUS][start_isle_ix][finalisle][midisle]-> */
static pid_t debugoutpid;
const char *arg;
int i, ap;
int granui;
+ const char *database=0;
#ifndef debug_flags
debug_flags= ~( dbg_sql2 );
for (;;) {
arg= *++argv;
if (arg[0] != '-') break;
+ if (!strcmp(arg,"-d")) {
+ database= *++argv;
+ } else if (!strcmp(arg,"-g")) {
+ granus= atoi(*++argv);
+ assert(granus>=1 && granus<=GRANUS);
#ifndef debug_flags
- if (!strcmp(arg,"-DN")) {
+ } else if (!strcmp(arg,"-DN")) {
debug_flags= 0;
- } else
+ } else if (!strcmp(arg,"-D1")) {
+ debug_flags= ~(dbg_sql2|dbg_lp|dbg_value2);
#endif
- {
+ } else {
abort();
}
}
debug_file= stderr;
}
- const char *database= *argv++;
-
sysassert( !setvbuf(debug,0,_IOLBF,0) );
max_mass= atof(*argv++);
double loss_per_league= atof(*argv++);
distance_loss_factor_per_league= 1.0 - loss_per_league;
+ min_trade_maxprofit= atoi(*argv++);
+
setup_sql(database);
setup_value();
setup_search();
else final_isle= atoi(final_isle_spec);
assert(final_isle);
- PotentialResult ****buckets_base_io[GRANUS];
+ Bucket ****buckets_base_io[GRANUS];
for (granui=0; granui<GRANUS; granui++)
buckets_base_io[granui]= &results[granui][resultsix];
for (granui=0; granui<granus; granui++) {
fprintf(output,"\n");
for (i=0; i<resultsix; i++) {
- tabdebugf("========== start #%d granui%d %s [PARTIAL] ==========\n",
+ tabdebugf("========== start #%d granui%d %s ==========\n",
i, granui, argv[i]);
- PotentialResult ***buckets_resultsix= results[granui][i];
+ Bucket ***buckets_resultsix= results[granui][i];
if (!buckets_resultsix) continue;
tabdebugf(" ");
for (mid=0; mid<granusz_mid[granui]; mid++) {
}
tabdebugf("\n");
for (fin=0; fin<granusz_fin[granui]; fin++) {
- PotentialResult **buckets_fin= buckets_resultsix[fin];
+ Bucket **buckets_fin= buckets_resultsix[fin];
if (!buckets_fin) continue;
tabdebugf("f%-3d",fin);
for (mid=0; mid<granusz_mid[granui]; mid++) {
- PotentialResult *result= buckets_fin[mid];
+ Bucket *result= buckets_fin[mid];
if (!result) {
tabdebugf("| ");
} else {
- tabdebugf("|%5d",(int)(result->value[A]));
+ tabdebugf("|%5d",(int)(result->prs[A].value[A]));
tabdebugf(" ");
- tabdebugf("%4d",(int)(result->value[P]));
+ tabdebugf("%4d",(int)(result->prs[P].value[P]));
}
}
tabdebugf("\n");
granui, ap);
for (pos=nhighscores[granui][ap]-1; pos>=0; pos--) {
HighScoreEntry *hs= &highscores[granui][ap][pos];
- PotentialResult *pr= hs->pr;
- if (!pr) continue;
- const int *const ports= pr->ports[ap];
+ Bucket *bucket= hs->bucket;
+ if (!bucket) continue;
+ OnePotentialResult *pr= &bucket->prs[ap];
+ const int *const ports= pr->ports;
int nports;
for (nports=0; nports<MAX_ROUTELEN && ports[nports]>=0; nports++);
int finisle= ports[nports-1];
int midarch= route2midarch(ports,nports);
fprintf(output,
" @%2d %c#%2d | start%3d mid%d:%3d f%d:%3d | %5d %5d %4d |",
- pos, "ap"[ap], nhighscores[granui][ap] - 1 - pos,
+ pos, "ap"[ap], nhighscores[granui][ap] - pos,
ports[0], midarch,midisle, finarch,finisle,
(int)hs->value, (int)pr->value[A], (int)pr->value[P]);
for (i=0; i<nports; i++) fprintf(output," %d",ports[i]);