document sample usage in scmap
[perl/schtarr.git] / graphplay
index d6baebfe517f1102a120bc8d6061948739f7ffd7..bbbbc28f98c81af6a25c23a2c8bf12b387d2527f 100755 (executable)
--- a/graphplay
+++ b/graphplay
@@ -2,10 +2,17 @@
 use strict;
 use warnings;
 
+use Getopt::Long 2.33 qw(HelpMessage :config bundling);
 use Template;
 use List::Util;
 use Data::Dumper;
 
+our $VERSION = '1.00';
+
+GetOptions(
+       "verbose|v!" => \our $DEBUG,
+) or HelpMessage(-exitval => 2);
+
 my %area = (
        fieldxmin => 45,
        fieldxmax => 1590,
@@ -54,6 +61,22 @@ for my $input (@ARGV) {
                }
        }
 
+       for (0 .. 2) {
+               my $line = $lines[$_][$player];
+               my $start;
+               my $lasty;
+               for (my $i = 1; $i <= $#$line; $i++) {
+                       defined $line->[$i] or next;
+                       if ($line->[$i][1] == $line->[$i - 1][1]) {
+                               $start = $i unless defined $start;
+                       } elsif (defined $start) {
+                               delete @$line[$start .. $i-2];
+                               undef $start;
+                       }
+               }
+               delete @$line[$start .. $#$line-2] if defined $start; # or -1
+       }
+
        $player++;
 }