Hi Monks,

I'm working up to writing a Perl Freecell Solver - for no particular reason since it's been done a hundred times before, and I'm sure better than I could ever do. I'm just trying to keep my 65-year-old brain active. I'm about 3/4 of the way through writing a command-line player. Complicated! Jeez, what was I thinking?

My current problem is writing a Freecell Dealer. There's some pretty good code click here, but it produces some weird 4-character Unicode results.

The first character is always a Greek Gamma, the second is always a o-umlaut or o-diaeresis (or maybe it's a Greek Omicron?). The third character encodes the card's suit: u-acute = hearts, a-underscore(?) = diamonds, capital Enya = clubs, a-acute = spades. The fourth character is the correct rank: A=ace, T=10, J=Jack, Q=Queen, K=King. So it's working correctly - but I don't like the Unicode results.

How can I modify it so that the output is more "normal" - 9C = Nine of Clubs, JD = Jack of Diamonds, etc.

No sense reinventing the wheel. Just want to make the wheel round.

P.S. The code author chose game 11982 - the Impossible game - to illustrate his slightly obfuscated code. Run it with the parameter "1" on the command line, and you should get what's at the top of the linked page.

Thanks
Dave Hennessey


In reply to Freecell Dealer by hennesse

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.