3 # This is part of the YARRG website. YARRG is a tool and website
4 # for assisting players of Yohoho Puzzle Pirates.
6 # Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Affero General Public License as
10 # published by the Free Software Foundation, either version 3 of the
11 # License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Affero General Public License for more details.
18 # You should have received a copy of the GNU Affero General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
22 # are used without permission. This program is not endorsed or
23 # sponsored by Three Rings.
25 use strict (qw(vars));
29 my $ocean= shift @ARGV;
33 my $islands= $dbh->selectall_arrayref('
34 SELECT islandid,islandname FROM islands;
36 my $routes= $dbh->selectall_arrayref('
37 SELECT aiid, biid, dist FROM routes;
42 #print Dumper($results);
44 print "strict graph $ocean {\n";
45 print " splines=true;\n";
46 print " nslimit=10;\n";
47 print " mclimit=10;\n";
49 foreach my $row (@$islands) {
50 my ($id,$str) = @$row;
51 $str =~ s/[\"\\]/\\$&/g;
52 print " n$id [ label=\"$str\" ];\n";
54 foreach my $row (@$routes) {
55 my ($ia,$ib,$dist) = @$row;
56 print " n$ia -- n$ib [ w=".(1.0/($dist*$dist)).", len=".(0.5*$dist+1).", label=$dist ];\n";
57 #len=$dist, minlen=$dist, , ,