chiark / gitweb /
Merge branch 'refs/remote/t.fa.dict.test' into stable-5.x
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 31 Oct 2009 13:59:58 +0000 (13:59 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 31 Oct 2009 13:59:58 +0000 (13:59 +0000)
31 files changed:
yarrg/Commods.pm
yarrg/Makefile
yarrg/README
yarrg/commod-results-processor
yarrg/commod-update-receiver
yarrg/db-idempotent-populate
yarrg/dictionary-update-receiver
yarrg/notes.linear-programming [deleted file]
yarrg/ocean-topology-graph
yarrg/rscommon.h
yarrg/rsmain.c
yarrg/rssearch.c
yarrg/rssql.c
yarrg/rsvalue.c
yarrg/structure.c
yarrg/update-master-info
yarrg/web/check_capacitystring
yarrg/web/devel
yarrg/web/docs
yarrg/web/dumptable
yarrg/web/intro
yarrg/web/lookup
yarrg/web/query_age
yarrg/web/query_commod
yarrg/web/query_offers
yarrg/web/query_route
yarrg/web/query_routesearch
yarrg/web/routetrade
yarrg/web/source.tar.gz
yarrg/web/style.css [new file with mode: 0755]
yarrg/yppedia-ocean-scraper

index 6cad3e31e0b8e37fbcaccac2933f64f0e2013078..e63126ace25bb25fa65006d4e028bc4c0154969b 100644 (file)
@@ -22,6 +22,7 @@
 
 package Commods;
 use IO::File;
+use IO::Pipe;
 use HTTP::Request::Common ();
 use POSIX;
 use LWP::UserAgent;
@@ -45,13 +46,40 @@ BEGIN {
                      &pipethrough_run_gzip &http_useragent &version_core
                      &http_useragent_string_map
                      &cgipostform &yarrgpostform &cgi_get_caller
-                     &set_ctype_utf8 $masterinfoversion);
+                     &set_ctype_utf8 $masterinfoversion
+                     &source_tarball);
     %EXPORT_TAGS = ( );
 
     @EXPORT_OK   = qw();
 }
 
-our $masterinfoversion= 2; # version we understand
+our $masterinfoversion= 2; # version we understand.
+#
+# To extend the source-info.txt format:
+#
+#    * Commods.pm:parse_info1
+#       add code to parse new version
+#
+#    * source-info.txt
+#       add new information
+#
+# If new data should NOT be in master-info.txt too:
+#
+#    * update-master-info:process_some_info
+#       check that code for converting source-info to master-info
+#       removes the extra info; add code to remove it if necessary
+#
+#    * db-idempotent-populate
+#       if database schema is extended, add code to copy data
+#
+# If new data DOES need to be in master-info.txt too:
+#
+#    * Commods.pm:$masterinfoversion
+#       increment
+#
+#    * update-master-info:process_some_info
+#       add code to convert new version to old, by removing
+#       extra info conditionally depending on version
 
 our %oceans; # eg $oceans{'Midnight'}{'Ruby'}{'Eta Island'}= $sources;
 our %clients; # eg $clients{'ypp-sc-tools'}= [ qw(last-page) ];
@@ -410,4 +438,38 @@ sub http_useragent ($) {
     return $ua;
 }
 
+sub source_tarball ($$) {
+    my ($sourcebasedir,$spitoutfn) = @_;
+
+    my $pipe= new IO::Pipe or die $!;
+    my $pid= fork();  defined $pid or die $!;
+    if (!$pid) {
+       $ENV{'YPPSC_YARRG_SRCBASE'}= $sourcebasedir;
+       $pipe->writer();
+       exec '/bin/sh','-c','
+               cd -P "$YPPSC_YARRG_SRCBASE"
+               (
+                git-ls-files -z;
+                git-ls-files -z --others --exclude-from=.gitignore;
+                if test -d .git; then find .git -print0; fi
+               ) | (
+                cpio -Hustar -o --quiet -0 -R 1000:1000 || \
+                cpio -Hustar -o --quiet -0
+               ) | gzip
+       ';
+       die $!;
+    }
+    $pipe->reader();
+
+    my ($d, $l);
+    while ($l= read $pipe, $d, 65536) {
+       $spitoutfn->($d);
+    }
+    waitpid $pid,0;
+    defined $l or die "read pipe $!";
+    $pipe->error and die "pipe error $!";
+    close $pipe;
+    # deliberately ignore errors
+}
+
 1;
index a9c833b622760f697f86d30fe52c5b1bef6d547e..44441bc19370b843229dc1f79de831769d76c4ab 100644 (file)
@@ -1,4 +1,3 @@
-
 # This is part of ypp-sc-tools, a set of third-party tools for assisting
 # players of Yohoho Puzzle Pirates.
 #
@@ -9,6 +8,12 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
+# The parts of the code used for the website (including the web/
+# directory and the rs*.[ch] which make up the routesearch program)
+# are released instead under the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -31,10 +36,14 @@ DEBUG=-g
 
 CFLAGS += $(WARNINGS) $(WERROR) $(OPTIMISE) $(DEBUG)
 
-TARGETS= yarrg
+TARGETS_CLIENT= yarrg
+TARGETS_SERVER= routesearch
+TARGETS= $(TARGETS_CLIENT) $(TARGETS_SERVER)
 
-default: clean-other-directory $(TARGETS)
-all: default routesearch
+default: clean-other-directory client
+client: $(TARGETS_CLIENT)
+server: $(TARGETS_SERVER)
+all: client server
 
 CONVERT_OBJS= convert.o ocr.o pages.o structure.o rgbimage.o resolve.o
 COMMON_OBJS= common.o
index d5062ac6ed0ae6111b15f80a0dc1848cc1b491b0..10555f47aa039121c0881af27ee8f5c01906692a 100644 (file)
@@ -178,7 +178,8 @@ Copyright (C) 2009 Steve Early
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of
- (a) for the website code, the GNU Affero General Public License and
+ (a) for the website code including the route searcher,
+      the GNU Affero General Public License and
  (b) for the rest of the code, GNU General Public License
 as published by the Free Software Foundation, either version 3 of
 each applicable the License, or (at your option) any later version.
index 36804d35d64c34f25f07fbb22a0de06ad8ee9454..37484d6ef6ff071172036578b55a1eef3d2bb301 100755 (executable)
@@ -51,6 +51,7 @@ sub bs_read ($$) {
     return if @v <= $c;
     my ($price,$qty) = @v[$c..$c+1];
     return if !length($price) && !length($qty);
+    die "$price ?" unless $price =~ m/^\d/;
     die "$_ ?" unless length($price) && length($qty);
     $commod{$commod}{$bs}{$stall}= {
        Stall => $stall,
@@ -63,6 +64,10 @@ while (<>) {
     chomp;
     @v= split /\t/;
 #print STDERR "[".join("|",@v)."]\n";
+    foreach (@v[2..$#v]) {
+       s/\,//g;
+       die "$_ ?" if m/.\D/;
+    }
     ($commod,$stall) = @v;
     bs_read(Buy,  2);
     bs_read(Sell, 4);
@@ -204,8 +209,8 @@ sub bs_p_tsv ($$) {
     }
 }
 
-sub write_tsv ($) {
-    my ($f) = @_;
+sub write_tsv ($$) {
+    my ($f,$showhold) = @_;
     foreach $commod (sort keys %commod) {
        $current= $commod{$commod};
        my %stalls;
@@ -215,6 +220,9 @@ sub write_tsv ($) {
            printf($f "%s\t%s", $commod, $stall) or die $!;
            bs_p_tsv($f, Buy);
            bs_p_tsv($f, Sell);
+           if ($showhold && $commod{$commod}{Hold}) {
+               printf($f "\t%s", $commod{$commod}{Hold}) or die $!;
+           }
            print($f "\n") or die $!;
        }
     }
@@ -223,7 +231,7 @@ sub write_tsv ($) {
 }
 
 sub main__tsv () {
-    write_tsv(\*STDOUT);
+    write_tsv(\*STDOUT,1);
 }
 
 
@@ -449,7 +457,7 @@ sub main__uploadyarrg () {
     $o{'timestamp'}= $ENV{'YPPSC_DATA_TIMESTAMP'} or die;
 
     my $tf= pipethrough_prep();
-    write_tsv($tf);
+    write_tsv($tf,0);
     my $oz= pipethrough_run_gzip($tf);
     $o{'data'}=  [ undef, 'deduped.tsv.gz',
                    Content_Type => 'application/octet-stream',
index d01b6de1753c3cbfac8b7751d0266c5af36a0116..cbd98f84b2e15c64b64bd4e4d1674d856f95b1b4 100755 (executable)
@@ -3,22 +3,22 @@
 # This script is invoked when the yarrg client uploads to
 # the chiark database.
 
-# This is part of ypp-sc-tools, a set of third-party tools for assisting
-# players of Yohoho Puzzle Pirates.
+# This is part of the YARRG website.  YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
 #
 # Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
 #
 # This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 # Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
@@ -41,8 +41,6 @@ our $now= time;  defined $now or die $!;
 
 my $re_any= "^(.*)\$";
 
-parse_info_serverside();
-
 sub fail ($) {
     my ($msg) = @_;
     addlog("failing $msg");
@@ -63,6 +61,14 @@ sub must_param ($$) {
 
 my %o;
 
+if (param('get_source')) {
+    header('application/octet-stream');
+    source_tarball('..', sub { print $_[0] or die $!; });
+    exit 0;
+}
+
+parse_info_serverside();
+
 my $midtmp= "_mid-pid$$.hold";
 open MIDTMP, ">$midtmp" or die "$midtmp $!";
 stat MIDTMP or die $!;
index 1d106f2b4f9ef6924cebc6f19b0677ce8352d008..0ecde9e51ab82ee1bdffc4c71471fee19109c568 100755 (executable)
@@ -5,24 +5,24 @@
 #
 # usage: ./db-idempotent-populate <Oceanname>
 #  creates or updates OCEAN-Oceanname.db
-#  from master-master.txt
+#  from source-info.txt
 
-# This is part of ypp-sc-tools, a set of third-party tools for assisting
-# players of Yohoho Puzzle Pirates.
+# This is part of the YARRG website.  YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
 #
 # Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
 #
 # This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 # Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
index 352b9bbbfd09d77fb1f405be2a53b199d7627615..8ccea9823be369cb7fbe3221c11304baf3c97aac 100755 (executable)
@@ -3,29 +3,28 @@
 # This script is invoked when the yarrg wants to send an update to the
 # dictionary server.  See README.privacy.
 
-# This is part of ypp-sc-tools, a set of third-party tools for assisting
-# players of Yohoho Puzzle Pirates.
+# This is part of the YARRG website.  YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
 #
 # Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
 #
 # This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 # Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
 # are used without permission.  This program is not endorsed or
 # sponsored by Three Rings.
 
-
 # upload testing runes:
 #
 # YPPSC_YARRG_DICT_UPDATE=./ YPPSC_YARRG_DICT_SUBMIT=./ ./yarrg --ocean midnight --pirate aristarchus --find-island --same --raw-tsv >raw.tsv  
@@ -43,6 +42,12 @@ use IO::Handle;
 
 use Commods;
 
+if (param('get_source')) {
+    header('application/octet-stream');
+    source_tarball('..', sub { print $_[0] or die $!; });
+    exit 0;
+}
+
 my $aadepth=2;
 
 #---------- pixmaps ----------
diff --git a/yarrg/notes.linear-programming b/yarrg/notes.linear-programming
deleted file mode 100644 (file)
index e3c684c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-use glpk's standalone solver with cplex input, see
- glpk refman.ps.gz p84 for example
-don't use it own modelling language which is very complex
-
-Math::LP would be nice but depends on Math::LP::Solve which is not in
- Debian.
-
index e609e35778188dc147390cd3a451dc315c95da62..2336b43c453a717363049a18e4132cecd14b5293 100755 (executable)
@@ -1,5 +1,27 @@
 #!/usr/bin/perl -w
 
+# This is part of the YARRG website.  YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
+#
+# Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+# are used without permission.  This program is not endorsed or
+# sponsored by Three Rings.
+
 use strict (qw(vars));
 
 use CommodsDatabase;
index 45a5b3129e141af8369576e059bb386b497d823f..237cab1347d8006ed63587529fd61f442a34acb9 100644 (file)
@@ -1,3 +1,30 @@
+/*
+ * Route searcher - common definitions
+ */
+/*
+ *  This is part of the YARRG website, a tool for assisting
+ *  players of Yohoho Puzzle Pirates.
+ * 
+ *  Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU Affero General Public License as
+ *  published by the Free Software Foundation, either version 3 of the
+ *  License, or (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Affero General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU Affero General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  
+ *  Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ *  are used without permission.  This program is not endorsed or
+ *  sponsored by Three Rings.
+ */
+
 #ifndef RSCOMMON_H
 #define RSCOMMON_H
 
index 774f507e309857db3c603463ed276920a1c8bdb4..67d338b502d961dc3279874cacb1344ab173e4ba 100644 (file)
@@ -1,4 +1,29 @@
-/**/
+/*
+ * Route searcher - command line parsing and result printing
+ */
+/*
+ *  This is part of the YARRG website, a tool for assisting
+ *  players of Yohoho Puzzle Pirates.
+ * 
+ *  Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU Affero General Public License as
+ *  published by the Free Software Foundation, either version 3 of the
+ *  License, or (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Affero General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU Affero General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  
+ *  Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ *  are used without permission.  This program is not endorsed or
+ *  sponsored by Three Rings.
+ */
 
 #include "rscommon.h"
 
index 1dd29e5bfa2dc23293b640b41a44186851f96b3f..245070e9ad6c34740f576707dee52dca95df03b1 100644 (file)
@@ -1,4 +1,29 @@
-/**/
+/*
+ * Route searcher - recursive iteration over all routes
+ */
+/*
+ *  This is part of the YARRG website, a tool for assisting
+ *  players of Yohoho Puzzle Pirates.
+ * 
+ *  Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU Affero General Public License as
+ *  published by the Free Software Foundation, either version 3 of the
+ *  License, or (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Affero General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU Affero General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  
+ *  Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ *  are used without permission.  This program is not endorsed or
+ *  sponsored by Three Rings.
+ */
 
 #include "rscommon.h"
 
index 23b3bd04af68ff56033d754a1dca60349797fe08..043e34ed7790999cc4d09a9295e3dfca6d83f7b3 100644 (file)
@@ -1,3 +1,29 @@
+/*
+ * Route searcher - database helper functions
+ */
+/*
+ *  This is part of the YARRG website, a tool for assisting
+ *  players of Yohoho Puzzle Pirates.
+ * 
+ *  Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU Affero General Public License as
+ *  published by the Free Software Foundation, either version 3 of the
+ *  License, or (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Affero General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU Affero General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  
+ *  Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ *  are used without permission.  This program is not endorsed or
+ *  sponsored by Three Rings.
+ */
 
 #include "rscommon.h"
 
index d3ffeeb1f8c651c280d9599f499f632ae4862dad..b469378303de295f3c12d17b20cc9b65f44ac772 100644 (file)
@@ -1,4 +1,29 @@
-/**/
+/*
+ * Route searcher - route evaluation
+ */
+/*
+ *  This is part of the YARRG website, a tool for assisting
+ *  players of Yohoho Puzzle Pirates.
+ * 
+ *  Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU Affero General Public License as
+ *  published by the Free Software Foundation, either version 3 of the
+ *  License, or (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Affero General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU Affero General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  
+ *  Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ *  are used without permission.  This program is not endorsed or
+ *  sponsored by Three Rings.
+ */
 
 #include <glpk.h>
 
index 46b6853339580cb6df798fc3b28c835b95b7c59b..cc1e71360d6c0c9ff9d6997b76c7438ee8d7489a 100644 (file)
@@ -646,15 +646,6 @@ static inline Fixpt find_aa_density(const RgbImage *ri, Point p) {
   Fixpt alpha_mean= fixpt_mul(alpha_total, one_third);
   
   Fixpt thresh= dbl2fixpt(1.5/AAMAXVAL);
-  Fixpt alpha_min= alpha_mean - thresh*2;
-  Fixpt alpha_max= alpha_mean + thresh*2;
-
-  for (i=0; i<3; i++)
-    MUST( alpha_min <= alpha[i] && alpha[i] <= alpha_max,
-         MP(p);
-         MRGB(here);MRGB(aa_background);MRGB(aa_foreground);
-         MFP(aa_alpha_mean_max);MFP(thresh);MFP(alpha_mean);
-         MFP(alpha_min);MI(i);MFP(alpha[i]);MFP(alpha_max) );
 
   MUST( -thresh <= alpha_mean && alpha_mean <= aa_alpha_mean_max + thresh,
        MP(p);
index e2b0973db453b093e9b6f261b60c5f2969701e8b..f7574555d88069356991fe261f7d675c148f3098 100755 (executable)
 #         ./update-master-info -b -d ~ftp/users/ijackson/yarrg/ -a
 #         ./update-master-info -b -d ~ftp/users/ijackson/yarrg/ -O ...
 
-# This is part of ypp-sc-tools, a set of third-party tools for assisting
-# players of Yohoho Puzzle Pirates.
+# This is part of the YARRG website.  YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
 #
 # Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
 #
 # This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 # Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
index a79b6f1ac06f1dffbed02820e33a819a1e31bb29..52eab28264836ca8208e49a82a16db9beb8e3597 100644 (file)
@@ -85,7 +85,7 @@ my $parse_values= sub {
        elsif (s/^( $fqtyrex ) \s* t  \s+ //xo) { $def->(0, $1 * 1000.0 ); }
        elsif (s/^( $fqtyrex ) \s* l  \s+ //xo) { $def->(1, $1          ); }
        elsif (s/^( $fqtyrex ) \s* kl \s+ //xo) { $def->(1, $1 * 1000.0 ); }
-       elsif (s/^( $iqtyrex ) \s* ([a-z ]+) \s+ //xo) {
+       elsif (s/^( $iqtyrex ) \s* ([a-z ]+) \s+ //ixo) {
                my ($qty,$spec) = ($1,$2);
                $debugf->("VALUE COMMOD $qty '$spec'");
                expected_error("Capacity specification must start with".
@@ -129,7 +129,7 @@ my $parse_term= sub {
                        $_ *= $pct / 100.0;
                }
                push @canon, sprintf "%g%%", $pct;
-       } elsif (!m/[^a-z]/) {
+       } elsif (!m/[^a-z]/i) {
                $debugf->("TERM NAME");
                expected_error("Name (should be unit or commodity) \`$_'".
                                " without preceding quantity")
@@ -140,7 +140,7 @@ my $parse_term= sub {
                    dbw_lookup_string($_,$sth,1,1,2,
                                "Ship name `$_' not understood.",
                                "Too many matching ship types.",
-                               sub { "Ambiguous - could be $_[0]" });
+                               sub { "Ambiguous - could be $_[1]" });
                expected_error($emsg) if defined $emsg;
                $debugf->("TERM NAME SHIP '$ship' @smv");
                $show_answer= 1;
@@ -152,7 +152,7 @@ my $parse_term= sub {
        $first_term= 0;
 };
 
-while ($string =~ s/^(.*?)(\bminus\b|-|\bplus\b|\+)//) {
+while ($string =~ s/^(.*?)(\bminus\b|-|\bplus\b|\+)//i) {
        my ($lhs)= ($1);
        my @nextsign= $2 =~ m/^p|^\+/ ? (+1,'+') : (-1,'-');
        $show_answer= 1;
index fecd77dc1b25449701391f4a8a65d6b888703d6b..b296d14bec121b950da7f5b275cc498e5942db58 100755 (executable)
 </%doc>
 <html lang="en"><head>
 <title>YARRG (Yet Another Revenue Research Gatherer)</title>
+<link rel="stylesheet" type="text/css" href="style.css">
 </head><body>
 
+<div class="navoptbar">
 <a href="lookup">YARRG</a> -
  Yet Another Revenue Research Gatherer
 |
@@ -45,6 +47,8 @@
 <a href="docs">documentation</a>
 |
 <b>development</b>
+</div>
+<div class="docs">
 
 <h1>YARRG development, contribution and troubleshooting</h1>
 
@@ -52,9 +56,9 @@
 
 YARRG is Free Software - you may share and modify it.  See the
 licences for details.  Not only the client but also the website code
-is Free.  The yarrg client, support files, and so forth are under
-the GNU GPL (v3 or later); the website is under the GNU Affero GPL (v3
-or later).
+is Free.  The yarrg client, support files, and so forth are under the
+GNU GPL (v3 or later); the website and database backend is under the
+GNU Affero GPL (v3 or later).
 
 <p>
 
@@ -78,21 +82,35 @@ the source for their version, the website code itself lets you download
 an up-to-date of its actually-running source code.  So this link
 gives you the source code for the pages you are now looking at.
 
-<h3>YARRG lookup website instances</h3>
+<h3>YARRG website code instances</h3>
+
+<h4>Lookup website</h4>
  <ul>
- <li><a href="http://yarrg.chiark.net/">Main released site</a>
- <li><a href="http://yarrg.chiark.net/test/data">Released code; testing database instance (updated with yarrg --test-servers)</a>
- <li><a href="http://yarrg.chiark.net/test/code">Testing version of the site code</a>
- <li><a href="http://yarrg.chiark.net/test/both">Testing code running against the testing database instance</a>
+ <li><a href="http://yarrg.chiark.net/">Main released site</a>,
+     with <a href="http://yarrg.chiark.net/source.tar.gz">source code</a>
+ <li><a href="http://yarrg.chiark.net/test/data">Released code; testing database instance (updated with yarrg --test-servers)</a> (source code as above)
+ <li><a href="http://yarrg.chiark.net/test/code">Testing version of the site code</a>,
+     with <a href="http://yarrg.chiark.net/test/source.tar.gz">source code</a>
+ <li><a href="http://yarrg.chiark.net/test/both">Testing code running against the testing database instance</a> (source code as above)
  </ul>
 
-Each of these allows you to download its own source code so you
-can get both the testing and the main version of the website.
-
 <p>
 
 You can add the form parameter <kbd>?debug=1</kbd> to each of the
-above to get a version of the site with debugging output enabled.
+website URLs above to get a version of the site with debugging output enabled.
+
+<h4>Database and dictionary update receiver</h4>
+
+On the live system there are different trees, potentially with
+different versions, for receiving updates and managing the database,
+to the ones for displaying the website.  The database management trees
+are normally accessed only via the upload client but you may also
+download their source directly:
+
+ <ul>
+ <li><a href="http://upload.yarrg.chiark.net/commod-update-receiver?get_source=1">Main production instance</a>
+ <li><a href="http://upload.yarrg.chiark.net/test/commod-update-receiver?get_source=1">Testing database instance</a>
+ </ul>
 
 <h3>Data</h3>
 
@@ -141,4 +159,5 @@ Email Ian Jackson ijackson (at) chiark.greenend.org.uk.  Or talk to
 any Fleet Officer or above of the crew Special Circumstances on the
 Midnight Ocean.
 
+</div>
 <& footer, isdevel => 1 &>
index 9feaa6b651d02f6d60aa068ee3e004eb19f5cd81..02cbeebdc90ba63569582c2fbd3bd21fa90ae9e2 100755 (executable)
 
 </%doc>
 <html lang="en"><head><title>Website documentation - YARRG</title>
+<link rel="stylesheet" type="text/css" href="style.css">
 </head><body>
 
+<div class="navoptbar">
 <a href="lookup">YARRG</a> -
  Yet Another Revenue Research Gatherer
 |
@@ -44,6 +46,8 @@
 <b>documentation</b>
 |
 <a href="devel">development</a>
+</div>
+<div class="docs">
 
 <h1>Looking up data in YARRG</h1>
 
@@ -202,4 +206,5 @@ them for 20 PoE each, and then buy 2000 beans at B for 10 PoE each and
 sail them to C to sell for 20 PoE each even if such a trade would in
 fact be possible.  In practice this is unlikely to be a problem!
 
+</div>
 <& footer &>
index 739f14d8b04f8eb3a8993f3572637c9f804ce22d..4e1fb3e5215e743ec7be8f06b505ecd82f44a2a8 100644 (file)
@@ -59,7 +59,7 @@ $cols => $sth->{NAME}
 $qa => undef
 </%args>
 %      if (!$qa || $qa->{'debug'}) {
-<table frame=box rules=all>
+<table class="data" frame=box rules=all>
 <tr>
 %              foreach my $field (@$cols) {
 <th><% $field |h %>
index 825189b883e9a6c7f8fea8026d125f424b0fe524..8e993a0034254d7586dd13b315d3d68f13c7d1b1 100755 (executable)
 </%doc>
 <html lang="en"><head>
 <title>YARRG (Yet Another Revenue Research Gatherer)</title>
+<link rel="stylesheet" type="text/css" href="style.css">
 </head><body>
 
+<div class="navoptbar">
 <a href="lookup">YARRG</a> -
  Yet Another Revenue Research Gatherer
 |
@@ -45,7 +47,8 @@
 <a href="docs">documentation</a>
 |
 <a href="devel">development</a>
-
+</div>
+<div class="docs">
 <h1>Introduction to YARRG</h1>
 
 YARRG (Yet Another Revenue Research Gatherer) is a third-party tool
@@ -68,8 +71,8 @@ website.
 
 <h2>Uploading from Linux</h2>
 
-The YARRG upload client uploads both to YARRG and to the
-<a href="http://pctb.ilk.org/">PCTB testing server</a>.
+The YARRG upload client uploads both to YARRG and
+<a href="http://pctb.crabdance.com/">PCTB</a>.
 
 <p>
 
@@ -122,4 +125,5 @@ Email Ian Jackson ijackson (at) chiark.greenend.org.uk.  Or talk to
 any Fleet Officer or above of the crew Special Circumstances on the
 Midnight Ocean.
 
+</div>
 <& footer &>
index a2ccc8de0a80df6b3659fafc95bdc41976888deb..365ed58129407277626411e60f96b8bc8fe2ba1e 100755 (executable)
@@ -128,12 +128,13 @@ $ours
 
 <html lang="en"><head><title><% ucfirst $ahtml{Query} %> - YARRG</title>
 <style type="text/css">
-body {
-  color: #000000;
-  background: #ffffff;
-}
-tr.datarow0 { background: #e3e3e3; }
-tr.datarow1 { background: #ffffff; }
+<& style.css &>
+  body { color: #000000; background: #c5c7ae; }
+  div.query { background: #d7d8b3; padding: 1em; }
+  div.results { padding: 1em; }
+  table.data { background: #b5b686; }
+  tr.datarow0 { background: #e3e3e3; }
+  tr.datarow1 { background: #ffffff; }
 </style>
 <&| script &>
   function register_onload(f) {
@@ -147,6 +148,7 @@ tr.datarow1 { background: #ffffff; }
 </head><body>
 
 % if (!printable($m)) {
+<div class="navoptbar">
 <a href="<% $m->current_comp()->name() |u %>">YARRG</a> -
  Yet Another Revenue Research Gatherer
 |
@@ -255,11 +257,13 @@ $debug => 0
 </%args>
 
 % if (!printable($m)) {
+</div>
 <hr>
 % }
 
 <& "query_$styles{Query}", %baseqf, %queryqf, %styles,
-    quri => $quri, dbh => $dbh, queryqf => \%queryqf, allargs => \%ARGS,
+    quri => $quri, dbh => $dbh,
+    baseqf => \%baseqf, queryqf => \%queryqf, allargs => \%ARGS,
     prselector => $prselector,
     someresults => $someresults,
     emsgokorprint => sub {
@@ -271,15 +275,14 @@ $debug => 0
     }
  &>
 
-<p>
-
 %#---------- debugging and epilogue ----------
 
 % if ($debug) {
-<p>
+<div class="results">
 <pre id="debug_log">
 Debug log:
 </pre>
+</div>
 % }
 
 <&| script &>
index 7cfe54e291799e6c8daa53ec0207c0f4d37eeead..fd2044d97b4463457d88776b71dc0000b45590ea 100644 (file)
@@ -52,6 +52,7 @@ my $sth= $dbh->prepare("SELECT archipelago, islandid, islandname, timestamp
 $sth->execute();
 
 </%perl>
+<div class="results">
 
 <& SELF:pageload &>
 <%method pageload>
@@ -69,12 +70,11 @@ $sth->execute();
   $now
   $fetchrow
 </%args>
-<table id="ts_table">
+<table class="data" id="ts_table" rules="groups">
 <tr>
 <th>Archipelago
 <th>Island
 <th>Age
-</tr>
 % my $row;
 % my %da_ages;
 % my %ts_sortkeys;
@@ -142,6 +142,7 @@ Time since this page loaded:
 <& "lookup:formhidden", ours => sub { 0; } &>
 </form>
 
+</div>
 <%init>
 use POSIX;
 use CommodsWeb;
index 3b2bf3554533f40a334d63690dac86f023b16764..8d55f2686130568ba92d2c578dd787d2362e368e 100644 (file)
@@ -50,6 +50,7 @@ my ($commodname,$cmid);
 my $qa= \%ARGS;
 </%perl>
 
+<div class="query">
 <h1>Commodity enquiry</h1>
 
 % $prselector->('BuySell');
@@ -69,10 +70,13 @@ my $qa= \%ARGS;
 </form>
 
 %#========== results ==========
+</div>
+<div class="results">
 <%perl>
 
 $emsgokorprint->($emsg) or $cmid=undef;
-return unless defined $cmid;
+print("</div>"), return
+       unless defined $cmid;
 $someresults->();
 
 #---------- actually compute the results and print them ----------
@@ -109,7 +113,7 @@ foreach my $bs (split /_/, $ARGS{BuySell}) {
 %      my $rowix= 0;
 %      while ($island= $islands->fetchrow_hashref) {
 %              if (!$rowix) {
-<table id="<% $bs %>_table" rules=groups>
+<table class="data" id="<% $bs %>_table" rules=groups>
 <colgroup span=2>
 <colgroup span=1>
 <colgroup span=2>
@@ -212,3 +216,4 @@ No offers.
 <%perl>
 }
 </%perl>
+</div>
index 76f45c0da52f143bb39fd7de472c5a1118539cdf..779d80407dc767857e2a74fd389e07432a6b0f96 100644 (file)
@@ -54,6 +54,7 @@ my ($commodname,$cmid);
 my $qa= \%ARGS;
 </%perl>
 
+<div class="query">
 <h1>Prices for commodity at location(s)</h1>
 
 % $prselector->('BuySell');
@@ -79,12 +80,15 @@ my $qa= \%ARGS;
 <& "lookup:formhidden", ours => $ours &>
 
 </form>
+</div>
+<div class="results">
 
 %#========== results ==========
 <%perl>
 
 $emsgokorprint->($emsg) or $cmid=undef;
-return unless defined $cmid and @islandids;
+print("</div>"), return
+       unless defined $cmid and @islandids;
 
 foreach my $wf (@warningfs) { $wf->(); }
 
@@ -166,7 +170,7 @@ foreach my $bs (split /_/, $qa->{BuySell}) {
 </%perl>
 %      while ($row= $sth->fetchrow_arrayref) {
 %              if (!$rowix) {
-<table id="<% $bs %>_table" rules=groups>
+<table class="data" id="<% $bs %>_table" rules=groups>
 <colgroup span=2>
 <colgroup span=3>
 <colgroup span=1>
@@ -221,3 +225,5 @@ database.  This will be a pain for you to program, slow to run, and
 pointlessly overload our server.  Instead, see our
 <a href="devel">information for developers</a>
 to find out how to get testing data or a real-time feed.)
+
+</div>
index fb32bcdd705017d6ad82f7da4a3344c55b44b47e..a4e9a067e1b4c40b9c31215ad1bcc9abaee3f2fb 100644 (file)
@@ -64,8 +64,6 @@ my $goupdate= sub { $be_post ? 'Update' : 'Go' };
 
 </%perl>
 
-<h1>Specify route</h1>
-
 % # Sadly we need to do this rather hacky thing to make it be a POST
 % #  form if the user has already selected some thing(s)
 % if (!$qa->{Dropdowns}) {
@@ -77,6 +75,10 @@ my $goupdate= sub { $be_post ? 'Update' : 'Go' };
 %      } (0..$qa->{Dropdowns}-1));
 % }
 
+<div class="query">
+
+<h1>Specify route</h1>
+
 % $prselector->('ShowStalls');
 
 <& enter_route, qa => $qa, dbh => $dbh, emsg_r => \$emsg,
@@ -100,6 +102,8 @@ my $goupdate= sub { $be_post ? 'Update' : 'Go' };
 % };
 <& "lookup:formhidden", ours => $ours &>
 
+</div>
+<div class="results">
 <%perl>
 #========== results ==========
 
@@ -122,4 +126,5 @@ foreach my $warningf (@warningfs) {
    routeparams => $routeparams
  &>
 % }
+</div>
 </form>
index 65f57f881531797d36bd7df6f1b39c3db331fce2..9c583b8899338489228249fef319dc360e7d3883 100644 (file)
@@ -36,6 +36,7 @@
 <%args>
 $quri
 $dbh
+$baseqf
 $queryqf
 $islandstring => '';
 $capacitystring => '';
@@ -66,6 +67,7 @@ my $maxcountea=15;
 
 </%perl>
 
+<div class="query">
 <h1>Find most profitable routes and trades</h1>
 
 % if ($qa->{Dropdowns}) {
@@ -101,6 +103,8 @@ This feature is not available from the "drop down menus" interface.
 % }
 
 </form>
+</div>
+<div class="results">
 <%perl>
 
 if (!$emsg && $maxdist > $maxmaxdist) {
@@ -108,10 +112,12 @@ if (!$emsg && $maxdist > $maxmaxdist) {
                " supported, sorry.";
 }
 
-$emsgokorprint->($emsg) or return;
-@islandids or return;
-$allargs->{'submit'} or return;
-defined $routeparams->{MaxMass} or defined $routeparams->{MaxVolume} or return;
+print("</div>"), return
+     unless $emsgokorprint->($emsg)
+       and @islandids
+       and $allargs->{'submit'}
+       and (defined $routeparams->{MaxMass} or
+            defined $routeparams->{MaxVolume});
 
 #---------- prepare island names ----------
 
@@ -206,7 +212,7 @@ while (<$fh>) {
        for ($i=1; $i < @i-1; $i++) {
                push @{ $item->{Vias} }, $i[$i];
        }
-       my %linkqf= %$queryqf;
+       my %linkqf= (%$baseqf, %$queryqf);
        delete $linkqf{'query'};
        $linkqf{'routestring'}= join ', ', @fi;
        $item->{Url}= $quri->(%linkqf);
@@ -272,7 +278,7 @@ $someresults->();
 %      } else {
 <h2>Best routes for profit per league</h2>
 %      }
-<table rules=groups id="ap<% $ap %>_table">
+<table class="data" rules=groups id="ap<% $ap %>_table">
 <colgroup span=2>
 <colgroup span=1>
 <colgroup span=1>
@@ -292,7 +298,6 @@ $someresults->();
 <th>Start
 <th>Via
 <th>Finish
-<tr>
 <tr id="ap<% $ap %>_sortrow"><th><th><th><th><th><th><th>
 %      my $datarow=0;
 %      my %sortkeys;
@@ -344,7 +349,4 @@ Per league values count each island visited as one
 to be sailed.  All profit figures are somewhat approximate; get a
 complete trading plan for a route for accurate information.
 
-<%perl>
-
-
-</%perl>
+</div>
index 09e908b1ac44e160fb817dacb612a8c746e19b67..ce319facae713bb9e32edddf86a1509d979b4772 100644 (file)
@@ -625,7 +625,7 @@ Generated by YARRG at <strong><%
 %
 <h2><a name="plan">Voyage trading plan</a></h2>
 
-<table rules=groups <% printable($m) ? 'width=100%' : '' %> >
+<table class="data" rules=groups <% printable($m) ? 'width=100%' : '' %> >
 % my $tbody= sub {
 %      if (!printable($m)) { return '<tbody>'; }
 %#  return "<tr><td colspan=7><hr>";
@@ -857,7 +857,7 @@ Islands shown in reverse order of visits.<br>
 %      my $cdspan= $qa->{ShowStalls} ? ' colspan=2' : '';
 %      my $cdstall= $qa->{ShowStalls} ? '<th>Stall</th>' : '';
 <h2><a name="trades">Relevant trades</a></h2>
-<table id="trades" rules=groups>
+<table class="data" id="trades" rules=groups>
 <colgroup span=1>
 <colgroup span=2>
 <% $qa->{ShowStalls} ? '<colgroup span=2>' : '' %>
@@ -965,7 +965,7 @@ Islands shown in reverse order of visits.<br>
        throw => 'trades_sort', tbrow => 'trades_total' &>
   ts_sortkeys= <% to_json_protecttags(\%ts_sortkeys) %>;
 </&tabsort>
-
+<p>
 <input type=submit name=update value="Update">
 
 % } # !printable
index 1d92ad8584255028578f7b1cbb2da41f9376f5f5..0e47a83e38d755720427b9c453db6bed6cf33288 100755 (executable)
 </%doc><%flags>
 inherit => undef
 </%flags><%perl>
-use IO::Pipe;
 use CommodsWeb;
+use Commods;
 
 $r->content_type('application/octet-stream');
 $m->flush_buffer();
 
-$ENV{'YPPSC_YARRG_SRCBASE'}= sourcebasedir();
-my $pipe= new IO::Pipe or die $!;
-my $pid= fork();  defined $pid or die $!;
-if (!$pid) {
-       $pipe->writer();
-       exec '/bin/sh','-c','
-               cd -P "$YPPSC_YARRG_SRCBASE"
-               (
-                git-ls-files -z;
-                git-ls-files -z --others --exclude-from=.gitignore;
-                if test -d .git; then find .git -print0; fi
-               ) | (
-                cpio -Hustar -o --quiet -0 -R 1000:1000 || \
-                cpio -Hustar -o --quiet -0
-               ) | gzip
-       ';
-       die $!;
-}
-$pipe->reader();
-
-my ($d, $l);
-while ($l= read $pipe, $d, 65536) {
-       print $d;
+source_tarball(sourcebasedir(), sub {
+       print $_[0];
        $m->flush_buffer();
-}
-waitpid $pid,0;
-defined $l or die "read pipe $!";
-$pipe->error and die "pipe error $!";
-close $pipe;
-# deliberately ignore errors
+})
 
 </%perl>
diff --git a/yarrg/web/style.css b/yarrg/web/style.css
new file mode 100755 (executable)
index 0000000..a397e5c
--- /dev/null
@@ -0,0 +1,48 @@
+<%doc>
+
+ This is part of the YARRG website.  YARRG is a tool and website
+ for assisting players of Yohoho Puzzle Pirates.
+
+ Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ Copyright (C) 2009 Clare Boothby
+
+  YARRG's client code etc. is covered by the ordinary GNU GPL (v3 or later).
+  The YARRG website is covered by the GNU Affero GPL v3 or later, which
+   basically means that every installation of the website will let you
+   download the source.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+ Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
+ are used without permission.  This program is not endorsed or
+ sponsored by Three Rings.
+
+
+ This Mason component generates the top-level stylesheet which applies
+ to everything including lookups and documentation.
+
+</%doc>
+<%flags>
+inherit => undef
+</%flags>
+<%init>
+$r->content_type('text/css')
+  if $m->callers(-1) == $m->callers(0);
+</%init>
+
+  body { margin: 0; }
+  div.navoptbar { padding: 1em; background: #e0e0ff; }
+  address { background: #d7d8b3; padding: 1em; }
+  div.docs { padding: 1em; }
+  hr { display: none; }
index 68efa38f6781980c63308a55b55b4334195873d5..d55f7acab83d7d0a03ae21655059e4277e1e9068 100755 (executable)
@@ -2,22 +2,22 @@
 
 # helper program for getting information from yppedia
 
-# This is part of ypp-sc-tools, a set of third-party tools for assisting
-# players of Yohoho Puzzle Pirates.
+# This is part of the YARRG website.  YARRG is a tool and website
+# for assisting players of Yohoho Puzzle Pirates.
 #
 # Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
 #
 # This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 # Yohoho and Puzzle Pirates are probably trademarks of Three Rings and