old-school-hex.pl

​#!/usr/bin/perl # data goes where the first empty line is $doc = q{<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> Old School Hex Map }; # Example data: # # # %char = ( '"' => 'grass', '.' => 'empty', ); # Example input: # " " " " # " " . # " " . . # " " . $y = 0; while () { for ($i=0; $i < length($*)/2; $i++) { $type = $char{substr($*, $i * 2 + $y % 2, 1)}; if ($type) { $data .= sprintf(qq{ \n}, (2 * $i + $y % 2) / 2 * 173.2, $y * 150, $type); } } $y++; } $doc =~ s/\n\n/\n$data/; print $doc;

http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">