use v5.36; use rlib '.'; use HexGrid; use HexGrid::Pin; use Carp; use Data::Dumper; use feature "signatures"; no warnings "experimental::signatures"; my $coords_regex = qr/^\s*(-?\d+)\s*,\s*(-?\d+)\s*$/; my $grid = HexGrid->new(defaults => { style => { 'stroke-width' => 1, stroke => 'black' }, show_coords => 1}); my $test_file = shift; open (my $test_fh, $test_file); while (my $line = <$test_fh>) { my @fields = split '; ', $line; my $region = $grid->make_region(shift @fields); $region->{defaults}{colour} = shift @fields; foreach my $coords (@fields) { do { carp "Skipping bad spec: $coords"; next; } unless $coords =~ $coords_regex; $region->make_tile_at($1,$2); } } # say $grid->render; say wrap_in_html($grid); close $test_fh; sub wrap_in_html($grid) { my $html_builder = ""; $html_builder .= "\n\n
"; $html_builder .= "\n" . <