Archive for the ‘Computing’ Category.

Want something easy? Try Klondike

If you find that you keep loosing in La Belle Lucie (dispite my tips :-) then try something much easier: the classic Klondike. This rules of this game are a stark contrast to those of La Belle Lucie: here you’re allowed to do almost everything.

You can move cards around more or less as you please, they just have to be in sequence and of alternating suit. But what really matters here is that you’re not restricted to just the top-most card — you can move a build starting from any card in it. What a relief! :-) If you run out of cards in the talon, then just redeal — another thing which you aren’t allowed to do in La Belle Lucie…

I’ve been able to win four of my last eight Klondike games so that’s 50% — does somebody know the chances of winning in this game? Also, it seems that you have almost no chance of making a bad move in Klondike (again in contrast to La Belle Lucie where the most obvious moves often lead directly to a lost game). So is the game decided beforehand or do the player actually have some influence on the result?

La Belle Lucie tips

I’ve just written about how I’ve begun playing solitaire games, especially La Belle Lucie — accourding to PySol this game is also known as Clover Leaf and Midnight Oil. I’ll call it La Belle Lucie. The rules are quite easy:

  • Move all cards to the foundations to win.

  • The piles must be built in suit.

  • Only one card can be moved one at a time.

Now let me share what little I’ve found out with regards to a strategy for the game. Below is a screenshot of a typical situation in the game. Click on it to have it enlarged to full size.

La Belle Lucie — click to view full size

The piles on the tableau can be divided into two types, the first of which you will want to leave alone:

  • Locked piles. These are piles where the top cards are in sequence and of the same suit. There the top card cannot be moved. This is because La Belle Lucie is played with just a single deck and so there is just one correct position for each card. Note that the kings cannot be moved onto any other card, so any pile with a king at the top is automatically locked.

    An example of a more common locked pile is the one with the Queen of Hearts (Q) at the top: that card can only be put on the King of Hearts (K), it card cannot be moved elsewhere. So that pile is effectively locked.

    Piles with just one card also fall in this category. Even if the card in these “piles” could be moved to another pile it should never be done — since there’s just a single card moving it wont help anything since there’s no buried cards to reveal. So moving the card can never help.

    The Jack of Diamonds (♦J) is an example of such a lonely, but valuable, card.

  • Other piles, that is piles where the top cards does not form a sequence. These are the only cards that you will have a chance of moving, since all other cards are either locked or singletons.

Moving a card to another pile locks that pile since the two top-most cards now form a sequence and are of the same suit. That means that you should be careful when you move cards: always check first that the top card in the target pile cannot be moved.

In the example we could move the 5 onto the 6, but this would be a bad move since it locks the 6, which could have been moved to 7, which itself could have been moved with 8 to 9. At that point we reach a dead end in the moving, for 9 can only be moved onto 10, but that card is buried beneath 8 and 4. So to move 9 we would have to move 8 — but this card can only be placed on 9 and so we have no chance of moving 9. This effectively means that 9 is locked and so we can safely moved 8 onto it, followed by the other cards in the sequence.

This is the basic strategy: move unlocked cards onto locked cards. Continue doing this until all cards are part of locked piles or until no card can be moved. Then redeal and do it all again :-)

The cards in the foundations sometimes make things a little more subtle by giving you two ways of moving a given card. If, for example, you want to get rid of the ♣7 card so that the 3 is revealed, then you have two ways of doing this: moving ♣7 unto ♣8 on the tableau, or getting ♣6 on the foundation and then moving ♣6 there too. The problem of getting hold of 3 is equivalent to solving either of these two sub-problems. Always think in terms of such back-tracking: “if I want this card, then I have to move that card, which means that this other card most be moved…” Stop your back-tracking when you hit a cycle like above.

That’s it — if you know of anything extra worth noticing when playing La Belle Lucia please let me know!

It would also be very interesting to hear something about the statistics of the game: how often do you actually have a change, on average? The problem is that you might be unlucky in your last redeal and end up with a king at the top of a pile with another card from the same suit beneath the king. In that case you cannot win since the king cannot be moved, and thus the buried card is lost. I hate when that happens… :-)

Ultra-short permalinks

I’ve just changed what was supposed to be permanent: my permalink structure. But fear not, I really believe that cool URLs don’t change so of course all the old URLs still work! But in case I messed up anyway, please drop me a mail or leave a comment.

Keeping the old permalinks was easy, I just copied the last five mod_rewrite rules from my .htaccess file and inserted them after the block managed by [WordPress][]. By the way, I love my [SSH][] connection to mgeisler.net: there’s something very cool to it when you edit your .htaccess file in [Emacs][] on a live site… :-)

Hacking E17

Enlightenment logo E17 — the next version of the classic [Enlightenment][] window manager — is getting better and better each day, and it’s fun to hack! Not that I’ve done anything ground-breaking with it, but it’s fun nonetheless.

After my initial success with the keyboard move/resize patch I sat down and wrote a Danish translation for E17. This doesn’t really count at coding, except that I also changed the Autoconf and Automake macros used so that one no longer has to edit both configure.in and po/Makefile.am when adding new translations. Again, it’s nothing deep, but it’s nice to be able to contribute a little here and there. And by the way, if someone has any suggestions for the Danish translation then please send them my way… I have no clue how to translate several of the terms used in a window manager, for example, what Danish word would you translate ‘Shade’ into?

Danish or not — if you’re running Linux, then you should definitely try downloading Enlightenment (do a [CVS][] checkout of e17/libs and e17/apps) and build it. Everything builds and installs very nicely without requiring root access when you use ./autogen.sh --prefix=~/opt or similar. If you don’t want to bother compiling E17 yourself, then you can get packages for [Debian][] here. I don’t know about packages for other distributions, but try checking http://get-e.org/.

Holidays — playing with PEL

Of course something would be wrong if I didn’t play with my computer now that I finally am able to do it with good conscience :-)

I’m now playing with [PEL][], I want to make an online Exif editor where you can submit your image and then change the Exif information at will. It will take some time, but I think it will be a nice demo of what PEL can do. A long the way I hope to be able to improve PEL here and there when I figure out what works and what doesn’t. The funny thing about PEL is that I have only been using it in command-line [PHP][] scripts, but never before on a webpage. So I might have missed some things when I made it — time and experience will tell.