Commit | Line | Data |
---|---|---|
21c4e167 H |
1 | #!/usr/bin/env perl |
2 | # encode *.cells file to ShapeCollection.java format | |
3 | # usage cat spacefiller.cells | perl cells.pl | |
4 | ||
5 | print 'NAMEHERE = new Shape("NameHere", new int[][] {'."\n"; | |
6 | my ($l,$c); | |
7 | my ($x,$y) = (0,0); | |
8 | while(<>) { | |
9 | $y=0; | |
10 | $x++; | |
11 | @l = split(//, $_); | |
12 | while($c = pop(@l)) { | |
13 | $y++; | |
14 | if("$c" eq 'O') { print("new int[] {$x, $y},\n"); } | |
15 | } | |
16 | } | |
17 | print "});\n"; |