use strict; use lib '.'; use Piece; my @kinds = qw(i j l o s t z); foreach my $kind (@kinds) { my $piece = new Piece($kind); foreach my $angle (0, 90, 180, 270) { my $width = $piece->width($angle); my $height = $piece->height($angle); my $map = ''; for (my $y = 0; $y < $height; $y += 1) { if ($y > 0) { $map .= ', '; } $map .= '['; for (my $x = 0; $x < $width; $x += 1) { if ($x > 0) { $map .= ','; } $map .= '\'' . $piece->cell($angle, $x, $y) . '\''; } $map .= ']'; } print " '$kind$angle' => { width => $width, height => $height, map => [$map] },\n"; } }