#! /usr/bin/perl

foreach my $i (@ARGV) {
  my $n = $i;
  $n =~ s/.* - (.*)\.txt/$1/;
  my $o = $n;
  $o =~ tr/A-Z/a-z/;
  $o =~ tr/a-zA-Z0-9/-/c;
  open I, "$i";
  open O, ">maps/$o";
  print O "name \"$n\"\n";
  print O "data\n";
  while (<I>) {
    tr(-#12<!@oxMD |SE+)
      (-#$%<V+UCM@ |~*O);
    print O $_;
  }
  print O "end\n";
  close I; close O;
}
