use Data::Printer;
use Graph::Directed;
+use Graph::Writer::GraphViz;
binmode STDIN, 'encoding(UTF-8)';
binmode STDOUT, 'encoding(UTF-8)';
our $defcho;
our $quorum = 0;
+our $gfile;
+
+while (@ARGV && $ARGV[0] =~ /^-/) {
+ local $_ = shift @ARGV;
+ if (m/^--?$/) {
+ last;
+ } elsif (s/^-g//) {
+ $gfile = $_;
+ } else {
+ die "bad usage\n";
+ }
+}
+
sub addchoice {
my $choname = shift @_;
my $cho = $choices{$choname} = {
return 0;
}
+our $showg = $defeats->deep_copy();
+
our $schwartz;
for (;;) {
printf " %-5s %s\n", $_, $choices{$_}{Desc}
foreach ($schwartz->vertices());
+if (defined $gfile) {
+ foreach my $cho (values %choices) {
+ my $chn = $choices[$cho->{Index}];
+ my $label = "\\N\n$cho->{Desc}";
+ if ($cho->{Dropped}) {
+ $label .= "\nDropped: $cho->{Dropped}";
+ }
+ $showg->set_vertex_attribute($chn, 'label', $label);
+ }
+
+ my $gwriter = new Graph::Writer::GraphViz -format => 'ps';
+ $gwriter->write_graph($showg, $gfile);
+}
+
print ".\n";
#p %choices;