{"id":45,"date":"2005-06-25T15:07:51","date_gmt":"2005-06-25T05:07:51","guid":{"rendered":"http:\/\/www.somethinkodd.com\/oddthinking\/?p=45"},"modified":"2007-10-07T21:06:26","modified_gmt":"2007-10-07T11:06:26","slug":"the-finer-points-of-klondike","status":"publish","type":"post","link":"https:\/\/www.somethinkodd.com\/oddthinking\/2005\/06\/25\/the-finer-points-of-klondike\/","title":{"rendered":"The Finer Points of Klondike"},"content":{"rendered":"<p><!-- UnMarkedDown_2_01132526288--><\/p>\n<h3>Introduction<\/h3>\n<p>If <a href=\"http:\/\/caseyporn.com\/\">Casey<\/a> can write about <a href=\"http:\/\/caseyporn.com\/blog\/archives\/000783.html\">his relationship with Tetris<\/a>, I can write about my relationship with <a href=\"http:\/\/en.wikipedia.org\/wiki\/Klondike_%28solitaire%29\" title=\"Wikipedia definition of Klondike_%28solitaire%29\" class=\"wikipedia\">Klondike<\/a><\/p>\n<p>When I was a kid we couldn&#8217;t afford all of these <a href=\"http:\/\/en.wikipedia.org\/wiki\/Solitaire#A\" title=\"Wikipedia definition of Solitaire#A\" class=\"wikipedia\">fancy-pants solitaire games<\/a>. We only knew one single-player gard game. We couldn&#8217;t even afford to give a ten-dollar name, like &#8220;Klondike&#8221;, &#8220;Canfield&#8221; or &#8220;Fascination&#8221;. We didn&#8217;t even know it by the name by which it is now famous &#8211; &#8220;Microsoft Solitaire&#8221;. We simply called it &#8220;Patience&#8221;.<\/p>\n<p>We didn&#8217;t play no fandangled casino version of the game, either.  You turned over three cards at a time, as often as you like until you got stuck. There were no stinkin&#8217; points or pesky time-limits. Either you won, or you lost &#8211; it was that simple.<\/p>\n<h3>Single-Player Game<\/h3>\n<p>Klondike, as I now call it &#8211; I can afford the ten dollar name now &#8211; is a solitaire game; it is only made for one player, and it only works with one player. Don&#8217;t play Klondike with anyone near you, or you will both get frustrated.<\/p>\n<p>I subscribed to the <a href=\"http:\/\/catesworld.tripod.com\/ejunk\/boy-scouts.html\">old theory<\/a> that it was a safety device for travellers &#8211; if you ever get totally lost in the desert, pull out a pack of cards and start to play Klondike. Within minutes someone will find you, just to hiss &#8220;Put the black 7 on the red 8!&#8221;<\/p>\n<p>By the time I reached adolescence, I started to get a chip on my shoulder about people starting to play the game near me. Perhaps I am being unreasonable, but I still see it as a rude act. Starting a game of Klondike directly next to someone is sending out the message &#8220;I don&#8217;t want to talk to you. In fact, I so much want to avoid interacting with you, I will choose a second-rate, boring one-player card game over any of the far more interesting two-player games that are in existence.&#8221;<\/p>\n<h3>How shallow is Klondike?<\/h3>\n<p>Part of my attitude problem was that I understood the game to be pretty simplistic. Oh, sure, I had there were a few basic strategies to work on, but it was too much simple pattern-recognition and luck.<\/p>\n<p>Then, one day, I was playing it on my PC. Why? Because the game has exactly one thing going for it. It is small  and I could play it while I simultaneously waited for my software to compile and my files to download. I was, by the way, alone, so I had no philosophical objection to the game.<\/p>\n<p>I was hit by a piece of inspiration &#8211; it was better to work backwards up the stock, rather than forwards &#8211; I&#8217;ll explain shortly, but suffice to say I no longer immediately play an Ace from the stock the moment I see it (as just one example). If I was foolish enough to play in front of someone now, their hiss to put the black 7 on the red 8, without the context of the rest of the stock pile would be uninformed and even more annoying.<\/p>\n<p>This was a bit of a relevation to me &#8211; to have new insight into a game I have known for most of my life gave me a bit more respect for the game. It put it in a different class of games.<\/p>\n<p>If I learnt something new tomorrow about Backgammon, I wouldn&#8217;t be at all surprised &#8211; I understand that Backgammon is a moderately deep game, and I haven&#8217;t fathomed its depths. However I thought Klondike was much more shallow &#8211; that I had pretty much got the basic strategy for Klondike by the time I was 13 years old &#8211; maybe just a little tweaking was required here and there to get to optimal play. So to come up with a significant change to the way I played was a great surprise to me.<\/p>\n<p>Let me not mislead you &#8211; I still lose more often than I win. It is still a boring game, and not as fun as, say, Battlefield 2. In fact, playing my new strategy makes the game even more boring. It is still pattern recognition and luck, but the level of strategy increased significantly.<\/p>\n<h3>Am I inspired or just stupid?<\/h3>\n<p>A horrid thought was still in the back of my mind. Was this a bold new strategy, raising me into the ranks of the Klondike Kings, or was it just something that most 13 year olds worked out for themselves and I was just slower than everyone else?<\/p>\n<p>To test this theory, I chose an arbitrary page from the selection that Google offered: ChessAndPoker.com&#8217;s <a href=\"http:\/\/www.chessandpoker.com\/solitaire_strategy.html\">Solitaire Strategy Guide<\/a> by James Yates. I figured if he put the effort into solving solitaire that he put into Chess or Poker, I was on a winner. [This may be considered anecdotal, rather than research &#8211; I quickly skimmed a couple of other pages, and found quite different suggestions but nothing that undermined the analysis below.]<\/p>\n<h3>Playing the Yates Way<\/h3>\n<p>Yates has a list of nine rules. Some of them are obvious:<\/p>\n<blockquote><p>\n1. Always play an Ace or Deuce wherever you can immediately.\n<\/p><\/blockquote>\n<p>The justification is easy: There is nothing to lose by doing this.<\/p>\n<p>Some of the rules are more subtle, but I think most people would hit on them by the age of 18.<\/p>\n<blockquote><p>\n5. Don&#8217;t clear a spot unless there&#8217;s a King IMMEDIATELY waiting to occupy it.\n<\/p><\/blockquote>\n<p>The justification for this is easy too: There is nothing to gain by clearing a spot prematurely, but not doing it keeps your options open.<\/p>\n<p>Some Yates&#8217; rules are real, but nonetheless minor, optimisations &#8211; like the focus on &#8220;smoothness&#8221; and the formalisation of the &#8220;5,6,7 or 8&#8221; rule. These are the tweaks that help make you a better player, but I am not entirely convinced they make a huge difference from the heuristics I was using subconsciously in the past.<\/p>\n<p>Yates also seems to be silent on whether you should ever simply place a card from the stock to the hand just because you can. If a black 7 is showing on the stock, a red 8 is open and the other black 7 is already in play, is there any reason <em>not<\/em> to make the move?  I would answer yes. Yates says nothing.<\/p>\n<p>It seems that my optimisation is either wrong, or obscure enough to be beyond the typical player. That&#8217;s good news!<\/p>\n<h3>My Optimisation<\/h3>\n<p>I assume that you are playing the version of the game where three stock cards are turned over simultaneously, and you can go through the stock cards <em>ad infinitum<\/em> with no time limit.<\/p>\n<p>Imagine it is early in the game, and there are no spaces available for a king yet.<\/p>\n<p>Imagine the top 9 cards are:<\/p>\n<ol>\n<li>7 &clubs;<\/li>\n<li><font color=\"red\">2 &hearts;<\/font><\/li>\n<li><font color=\"red\">A &hearts;<\/font><\/li>\n<\/ol>\n<ol start=4>\n<li>A &spades;<\/li>\n<li><font color=\"red\">Q &hearts;<\/font><\/li>\n<li>A &clubs;<\/li>\n<\/ol>\n<ol start=7>\n<li>2 &clubs;<\/li>\n<li>K &clubs;<\/li>\n<li><font color=\"red\">K &hearts;<\/font><\/li>\n<\/ol>\n<p>A typical &#8220;greedy&#8221; approach would be to turn up the first 3 cards, and play the <font color=\"red\">A &hearts;<\/font> followed by the <font color=\"red\">2 &hearts;<\/font>. Then turn up the next three cards, and play the A &clubs;. That&#8217;s it.  The next run through the stock will reveal the <font color=\"red\">Q &hearts;<\/font>; and the <font color=\"red\">K &hearts;<\/font>, and leave nowhere to go.<\/p>\n<p>This time, lets reset the deck and take a more relaxed approach. First zip through the cards once, and don&#8217;t play any cards. Simply remember the <em>last<\/em> card that could be played. In this case, it is the A &clubs;.<\/p>\n<p>[Actually, where there are two similar cards that could both only be played to the tableau, you ignore the second one. For example, if there are two black sevens that could be played, ignore the second one.]<\/p>\n<p>Turn over the waste pile to create a new stock and start working through it again. This time, skip straight to your remembered card and play that. Proceed to the end of the deck using the greedy approach if any further cards are now playable.<\/p>\n<p>Turn over the waste pile again and start from the top of the algorithm. This time, you will notice the 2 &clubs; as the last legal play. That&#8217;s one we didn&#8217;t see before! Yay! It is working!<\/p>\n<p>Play that, and away we go again.<\/p>\n<p>This time through, we add another complication. <\/p>\n<p>The stock looks like this now:<\/p>\n<ol>\n<li>7 &clubs;<\/li>\n<li><font color=\"red\">2 &hearts;<\/font><\/li>\n<li><font color=\"red\">A &hearts;<\/font><\/li>\n<\/ol>\n<ol start=4>\n<li>A &spades;<\/li>\n<li><font color=\"red\">Q &hearts;<\/font><\/li>\n<li>K &clubs;<\/li>\n<\/ol>\n<ol start=7>\n<li><font color=\"red\">K &hearts;<\/font><\/li>\n<\/ol>\n<p>The last legal play is now the <font color=\"red\">A &hearts;<\/font>, but if we play that, we will reveal the <font color=\"red\">2 &hearts;<\/font>. Should we do a double play? That is, play both of the cards in succession?<\/p>\n<p>The answer depends on what the <em>very next<\/em> card in the stock would be. As it is the A &spades;, and that is immediately playable, we choose <em>not<\/em> to play the <font color=\"red\">2 &hearts;<\/font> now. Instead we work through the rest of the stock. When we get another chance to go through it we will find the A &spades; is now available. We wouldn&#8217;t have seen that if we did a double-play the first time. However, there is no reason not to do it this time. <\/p>\n<p>So this play revealed two more cards than the simple greedy approach would have found.<\/p>\n<h3>Play Summary<\/h3>\n<ul>\n<li>\n<p>The typical greedy approach would work forwards through the stock, constantly playing the first legal card that could be played.<\/p>\n<\/li>\n<li>\n<p>The new reverse approach works <em>backwards<\/em> through the stock, constantly playing the <em>last<\/em> distinct legal card that can be played. <\/p>\n<ul>\n<li>\n<p>If two similar cards are available (same rank and colour), competing for the same position on the tableau, the second one is ignored.<\/p>\n<\/li>\n<li>\n<p>Only accept a double play (or a triple for that matter) if the next hidden card in the stock would not be playable next time through the deck.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>Benefit<\/h3>\n<p>The benefit of this strategy is that the cards nearer the bottom of the stock are rotated more often &#8211; there is more opportunity to find the elusive cards that you need, and not have them get blocked behind other cards.<\/p>\n<p>This approach doesn&#8217;t guarantee a win.  It doesn&#8217;t even guarantee to do no worse than the greedy approach <em>on a given deal<\/em>. [There are some deals where greedy play would reveal combinations of cards in the correct order, where this approach shuffles the order they appear, making them unplayable.]<\/p>\n<p>However, I am confident it generally improves the chances of a game coming out, by reducing the risk of critical cards from being blocked behind others in the stock. <\/p>\n<p>You will notice that my logic is informal &#8211; I haven&#8217;t proven that I am right, nor have I established that the idea is original.  I&#8217;ll leave that to the Klondike historians! Right now, I&#8217;m going back to Battlefield 2!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Julian finds a surprising optimisation for Klondike<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"","footnotes":""},"categories":[23,21,33],"tags":[58,55,54],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-based-on-a-true-story","category-observation","category-puzzle-solving","tag-gaming","tag-puzzle","tag-solution"],"_links":{"self":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":0,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}