2 # pattern_spatial_show: Show given spatial dictionary entry on board
4 my $f = "patterns.spat";
9 open D
, "$f" or die "$f: $!";
12 if (s/^# Point order: d=(\d+) //) {
13 my $d = $1; next if ($d < 1);
14 # XXX: Distances must be in proper order!
16 push @ofs, map { [ split(/,/, $_) ] } split(/ /, $_);
18 # print "[$d] ($#ofs) " . join(' ', map { $_->[0].",".$_->[1] } @ofs) . "\n";
22 my ($lid, $d, $pat, @hashes) = split (/\s+/, $_);
26 my @pc = split (//, $pat);
27 for my $i (0 .. $#pc) {
28 # print "$i: $pc[$i] -> $ofs[$i][1],$ofs[$i][0]\n";
29 $b[$d + $ofs[$i][1]][$d + $ofs[$i][0]] = $pc[$i];
32 for my $y (0 .. 2 * $d) {
33 for my $x (0 .. 2 * $d) {
34 print $b[2 * $d - $y][$x] || ' ';