chiark / gitweb /
routesearch: show route distances
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 17 Oct 2009 15:46:52 +0000 (16:46 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 17 Oct 2009 15:46:52 +0000 (16:46 +0100)
yarrg/TODO
yarrg/rscommon.h
yarrg/rsmain.c
yarrg/rssearch.c
yarrg/web/query_routesearch
yarrg/x.gdb

index bc2899a8cab20229bb52dc4b154d6e71c8972e80..a23fc65af1e4c91ef2e53a40c0fd392fa791b8a0 100644 (file)
@@ -1,7 +1,5 @@
 routesearch:
 
 routesearch:
 
-       show distance
-
        concurrency limit option
 
 query_routesearch:
        concurrency limit option
 
 query_routesearch:
@@ -11,8 +9,6 @@ query_routesearch:
        ap=A, ap=P turn into proper headings
        notes about leagues
 
        ap=A, ap=P turn into proper headings
        notes about leagues
 
-       show distance
-
        links to per-route pages
 
        concurrency limit
        links to per-route pages
 
        concurrency limit
index 1e6679db087035d3a8e7e9da964a94fa94f1ef45..45a5b3129e141af8369576e059bb386b497d823f 100644 (file)
@@ -123,6 +123,7 @@ void setup_value(void);
 
 typedef struct {
   double value[AP];
 
 typedef struct {
   double value[AP];
+  int length;
   int ports[MAX_ROUTELEN];
 } OnePotentialResult;
 
   int ports[MAX_ROUTELEN];
 } OnePotentialResult;
 
index 345c8825d2443ba576fa7625a7a46449620d5d0c..437a13d35d837f552b229f100374bc5fd9699075 100644 (file)
@@ -189,9 +189,10 @@ int main(int argc, const char **argv) {
          int midisle= ports[nports/2];
          int midarch= route2midarch(ports,nports);
          fprintf(output,
          int midisle= ports[nports/2];
          int midarch= route2midarch(ports,nports);
          fprintf(output,
-                 " @%2d %c#%2d | start%3d mid%d:%3d f%d:%3d | %5d %5d %4d |",
+                 " @%2d %c#%2d | start%3d mid%d:%3d f%d:%3d"
+                 " | %3dlg | %5d %5d %4d |",
                  pos, "ap"[ap], nhighscores[granui][ap] - pos,
                  pos, "ap"[ap], nhighscores[granui][ap] - pos,
-                 ports[0], midarch,midisle, finarch,finisle,
+                 ports[0], midarch,midisle, finarch,finisle, pr->length,
                  (int)hs->value, (int)pr->value[A], (int)pr->value[P]);
          for (i=0; i<nports; i++) fprintf(output," %d",ports[i]);
          fprintf(output,"\n");
                  (int)hs->value, (int)pr->value[A], (int)pr->value[P]);
          for (i=0; i<nports; i++) fprintf(output," %d",ports[i]);
          fprintf(output,"\n");
index 1f43e0077fcf3c0ad2d32d852986097c60b3567d..1dd29e5bfa2dc23293b640b41a44186851f96b3f 100644 (file)
@@ -156,6 +156,7 @@ static double process_route(int nports, int totaldist,
       } else {
        int pos;
        ctr_newbests_granu[granui*AP+ap]++;
       } else {
        int pos;
        ctr_newbests_granu[granui*AP+ap]++;
+       bucket->prs[ap].length= totaldist;
        memcpy(bucket->prs[ap].value, value, sizeof(value));
        memcpy(bucket->prs[ap].ports, ports, sizeof(*ports) * nports);
        if (nports < MAX_ROUTELEN-1) bucket->prs[ap].ports[nports]= -1;
        memcpy(bucket->prs[ap].value, value, sizeof(value));
        memcpy(bucket->prs[ap].ports, ports, sizeof(*ports) * nports);
        if (nports < MAX_ROUTELEN-1) bucket->prs[ap].ports[nports]= -1;
index 6877536b14b20068ecda828c8a72a7364c58ecc1..b9b734806968750d406d0f52eb4a5735e3ecbc1b 100644 (file)
@@ -166,11 +166,10 @@ while (<$fh>) {
 <% $_ |h %>
 <%perl>
        }
 <% $_ |h %>
 <%perl>
        }
-       next unless
-  m/^ \@ *\d+ ([ap])\# *\d+ \|.*\| *\d+ +(\d+) +(\d+) *\| ([0-9 ]+)$/;
-       my ($ap,$isles) = (uc $1,$4);
+       next unless m/^ \@ *\d+ ([ap])\# *\d+ \|.*\| *(\d+)lg *\| *\d+ +(\d+) +(\d+) *\| ([0-9 ]+)$/;
+       my ($ap,$isles) = (uc $1,$5);
        next if $results{$ap} && %{$results{$ap}} >= $maxcountea;
        next if $results{$ap} && %{$results{$ap}} >= $maxcountea;
-       my $item= { A => $2, P => $3 };
+       my $item= { A => $3, P => $4, Leagues => $2 };
        my (@i, @a);
        foreach (split / /, $isles) {
                my ($name,$arch)= $isleinfo->($_);
        my (@i, @a);
        foreach (split / /, $isles) {
                my ($name,$arch)= $isleinfo->($_);
@@ -203,12 +202,14 @@ if ($qa->{'debug'}) {
 <tbody>
 <tr>
 <th colspan=2>Profit
 <tbody>
 <tr>
 <th colspan=2>Profit
+<th>Dist.
 <th>Archipelagoes
 <th colspan=3>Route
 <tr>
 <th>Abs.
 <th>Per.lg.
 <th>
 <th>Archipelagoes
 <th colspan=3>Route
 <tr>
 <th>Abs.
 <th>Per.lg.
 <th>
+<th>
 <th>Start
 <th>Via
 <th>Finish
 <th>Start
 <th>Via
 <th>Finish
@@ -222,6 +223,7 @@ if ($qa->{'debug'}) {
 <tr class="datarow<% $datarow %>">
 <td align=right><% $item->{A} |h %>
 <td align=right><% $item->{P} |h %>
 <tr class="datarow<% $datarow %>">
 <td align=right><% $item->{A} |h %>
 <td align=right><% $item->{P} |h %>
+<td align=right><% $item->{Leagues} |h %>
 <td align=left><% join ', ', @{ $item->{Archs} } |h %>
 <td align=left><% $item->{Start} |h %>,
 <td align=left><% join ' ', map { $_.',' } @{ $item->{Vias} } |h %>
 <td align=left><% join ', ', @{ $item->{Archs} } |h %>
 <td align=left><% $item->{Start} |h %>,
 <td align=left><% join ' ', map { $_.',' } @{ $item->{Vias} } |h %>
index 3bb9ef6e3fbad32d89f4382daa9044e4fd7a2c62..b5c490d96eda6705beda83883f7c45be71dcba3e 100644 (file)
@@ -1,4 +1,4 @@
 file ./routesearch
 file ./routesearch
-set args -d OCEAN-Midnight.db -g 3 -D1 13470 20220 -1 0.0005 search 10 10 30 any 34 7 5 10 35 24 2 2>u
+set args -d OCEAN-Midnight.db -g 3 13470 20220 -1 0.0005 search 0 10 10 30 any 34 7 5 10 35 24 2 2>u
 #break rssearch.c:179 if ports[0]==24 && ports[1]==21
 run
 #break rssearch.c:179 if ports[0]==24 && ports[1]==21
 run