Added *.tgz to .gitignore
[mirrors/Programs.git] / perl / cells.pl
CommitLineData
21c4e167
H
1#!/usr/bin/env perl
2# encode *.cells file to ShapeCollection.java format
3# usage cat spacefiller.cells | perl cells.pl
4
5print 'NAMEHERE = new Shape("NameHere", new int[][] {'."\n";
6my ($l,$c);
7my ($x,$y) = (0,0);
8while(<>) {
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}
17print "});\n";
This page took 0.118803 seconds and 4 git commands to generate.