chiark / gitweb /
preview png, actually make it a png
[pandemic-rising-tide.git] / generate-plag
1 #!/usr/bin/perl -w
2 #
3 # generate-plag - program for processing game board definitions
4 #
5 # Copyright (C) 2019 Ian Jackson
6 #
7 # This program is dual licensed, GPv3+ or CC-BY-SA 4.0+.
8 # Only to the Pandemic Rising Tide folks, it is permissively licensed.
9 #
10 #   This program is free software.
11 #
12 #   You can redistribute it and/or modify it under the terms of the
13 #   GNU General Public License as published by the Free Software
14 #   Foundation, either version 3 of the License, or (at your option)
15 #   any later version; or (at your option), under the terms of the
16 #   Creative Commons Attribution-ShareAlike International License,
17 #   version 4.0 of that License, or (at your option), any later
18 #   version.
19 #
20 #   This program is distributed in the hope that it will be useful,
21 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
22 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23 #   General Public License Creative Commons Attribution-ShareAlike
24 #   License or the for more details.
25 #
26 #   You should have received a copy of these licenses along with this
27 #   program.  If not, see <https://www.gnu.org/licenses/> and
28 #   <https://creativecommons.org/licenses/>.
29 #
30 # Pandemic and Pandemic Rising Tide are (I think) trademarks of Z-Man
31 # games and I use them without permission.
32
33 # For the avoidance of doubt, I do not consider this program to be a
34 # derivative work of the game Pandemic Rising Tide.  However, it is
35 # not very useful without a pair of game description files and the
36 # only nontrivial game description files I know of are indeed such
37 # derivatives.
38
39
40 use strict;
41 use Carp;
42
43 BEGIN { unshift @INC, qw(.); }
44
45 use Parse;
46
47 sub output_planar_graph () {
48   foreach my $ra (sort keys %region) {
49     o(plag_prs($ra), "\n");
50     if ($ra eq $c{Sea} || $ra =~ m/^L2?$/) { o(" :outer\n"); }
51     my $adjs = $region{$ra}{Adj};
52     foreach my $adj (reverse @$adjs) {
53       o(" ", plag_prs($adj->{Name}), "\n");
54     }
55   }
56   # RUST_BACKTRACE=1 target/release/plag-mangler <../pandemic-rising-tide/map.plag R DUAL OUTER-F2V OUTER-SPLIT B T OUTER-F2V OUTER-F12VA PCO CP RAE PRINT-VI-NAMES NLOPT WG t.dot | qtdebug/vtrace
57
58 }
59
60 parse_input_graph();
61 output_planar_graph();
62
63 # Local variables:
64 # cperl-indent-level: 2
65 # End.