# Unsuit.pl # This tries to convert all the Pagemaker suit symbols # into ASCII. The symbols are # hex a6 is a spade # hex 63 is a heart # hex 22 is a diamond # hex 15 is a club # The complicating factor is that # hex a6 is a vertical bar (|) # hex 63 is lower case c (c) # hex 22 is a double quote (") # hex 15 is control q (good!) # # Version 2: # It also converts "10" to "T" in hand diagrams only # and removes spaces between cards in hand diagrams. # It does this by finding lone suit symbols (ones with # space around them or at the beginning of a line and # with a space after them) and assuming that any line # with one of those is a hand diagram. This might or # might not work in general. We'll see. while (<>) { # if there is a lone suit symbol if (/\s\xa6\s/ || /\s\x63\s/ || /\s\x22\s/ || /\s\x15\s/ || /^\xa6\s/ || /^\x63\s/ || /^\x22\s/ || /^\x15\s/) { # change to "T" s/10/T/g; # remove spaces s/([AKQJT98765432]) /$1/g; } # change Pagemaker hex codes into SHDC s/ \xa6 / S /g; s/ \x63 / H /g; s/ \x22 / D /g; s/ \x15 / C /g; s/\t\xa6 /\tS /g; s/\t\x63 /\tH /g; s/\t\x22 /\tD /g; s/\t\x15 /\tC /g; s/^\xa6 /S /g; s/^\x63 /H /g; s/^\x22 /D /g; s/^\x15 /C /g; s/\xa6([AKQJT198765432][^a-wyz])/S$1/g; s/\x63([AKQJT198765432][^a-wyz])/H$1/g; s/\x22([AKQJT198765432][^a-wyz])/D$1/g; s/\x15([AKQJT198765432][^a-wyz])/C$1/g; s/([1234567])\xa6/$1S/g; s/([1234567])\x63/$1H/g; s/([1234567])\x22/$1D/g; s/([1234567])\x15/$1C/g; print; }