X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/038fe5ca52455d64865054bc1ccae57c0e9e4c79..9f0a6057388ceffc00f22ae5fe9a28250cc338be:/writing-latn.inc.pl diff --git a/writing-latn.inc.pl b/writing-latn.inc.pl index 3aab17a..5921802 100644 --- a/writing-latn.inc.pl +++ b/writing-latn.inc.pl @@ -1,21 +1,24 @@ use 5.014; use utf8; -use List::Util qw( pairs sum ); +use List::Util qw( pairs pairmap sum ); my %C = qw(red #EC1C24 blue #3953A3 yellow #F9EC31 black #231F20); my $U = 0; # optional unicode alternatives sub disptap { - return map { - !m/\A(-?)(\d)(\d)/ ? $_ : - $1.join(' ', - '·' x $2, '·' x $3, - ); - } @_; + my $code = shift; + $code =~ m/\A(-?)(\d)(\d)/ or return $code; + return $1 . join(' ', '·' x $2, '·' x $3); } sub dispbar { - my @cols = split //, shift; # bar and space widths + my $code = shift; + + return join '', pairmap { + ($a =~ tr/123/❘❙❚/r) . ($b =~ tr/321/  /dr) + } split //, $code if $U; + + my @cols = split //, $code; # bar and space widths my $width = sum(@cols); return sprintf( '', @@ -100,14 +103,14 @@ sub dispbar { .- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --.. }], -'Tap code' => [disptap(qw{ +'Tap code' => [map { disptap($_) } qw{ 11 12 13 14 15 21 22 23 > 24 25 31 32 33 34 35 41 42 43 44 45 51 52 53 54 55 -})], -'Short Tap' => [disptap(qw{ +}], +'Short Tap' => [map { disptap($_) } qw{ 11 12 13 14 21 22 23 20 > 31 -13 32 33 30 41 42 -13 43 40 10 51 52 53 50 -31 -40 -})], +}], 'Cards' => [( map { chr(0x1F0A0 + $_), sprintf('%s', chr(0x1F0B0 + $_)) } # spades, hearts 1 .. 11, 13, 14 # A 2-10 J Q K