MG Nov 26 2007 - Quite some time ago, I wrote a copy of Freecell, one of the card games shipped with Windows XP (and other versions, I think) with a friend of mine. I've finally gotten around to uploading the code, which you can find on my website [L1 ] as it's rather large for a wiki page.

It's pretty similar to the Windows version, though is definitely missing at least one feature: when you move cards, it always moves the most it can, rather than giving you the choice between moving a single card/the column.

The friend I wrote it with is also multi-lingual, so it runs in four different languages, using msgcat.

Comments, criticisms, suggestions for improvement, etc, welcome as ever.

IDG Nov 26 2007 - Nice - unlike the version that comes with Suse Linux which is unplayable. However SystemButtonFace is an unknown colour under Linux, so I had to change this before statistics would display.

MG Thanks; I'd only tried it on Windows. I've updated that now to use

  $toplevel cget -background

to get the correct background colour, which should work on all platforms, I think.

IDG Nov. 27 - I think there are some bugs in the statistics code, by the way. I managed to get a negative number of games lost at one point ...

MG I've not seen that problem, but I'll take a look at the code and see if I can see what might be causing it.

Steven [L2 ] Dec 14 - I like the way the undo feature works... When did you write this game ?

> Total:

> Played: 5
> Won:    0
> Lost:   5
> Current Streak: 1 loss

I thought that would mean my current streak was 5 loss ? Actually, i remember winning one game. I then selected i didn't want to play again, or something. There might be a little bug here somewhere.

.... Sometimes it clears a card to the pen, other times not. What are the criteria about clearing cards ?

MG It's the most recent cardgame I've written, but it's quite a while since I wrote it (many months, if not longer). It's quite possible there are some bugs - I had a quick look to see if I could spot the one IDG mentioned, but couldn't see anything obvious, and haven't had the time to delve deeper.

It should clear a card to the top whenever it's of no use (so, for instance, if you have both red 4s up already, it'll put black fives up automatically). I have a version that doesn't put the cards up automatically, but there's no gui-option for it yet, you have to edit a var in the code to turn it on. I'll try and get that cleaned up and posted soon, though.

Steven Dec 15. I guess it's possible the bug i noticed is from running multiple instances of the game, but in Tktk i keep game tallys and i had to keep the code fairly tight.

Steven Dec 19. It's nice to have a tcl freecell... i'm bored with hearts and spider. But some issues I have with the game are:

  1. The tally widget is confusing. Currently it shows a game-in-progress as lost and there's no need for it. Simply forget about it till they start a new game,or exit program (catch destroy), when you can then call the game as lost.
  2. I think the inverse card effect is ugly, but can live with it. What's more annoying is the having to unselect the card if you decide not to move it.I think behaviour should be: with a card selected, if the next click is not a valid target to move to, then the current card should be de-selected (and, optionally, the new column, selected).
  3. I've never seen F10 for undo. This is especially bad for GUIs that bind some function keys to window maximisations.
  4. Personally I think the green place-holder outlines are ugly, and invisible or black are nicer.

How come you didn't go for a drag and drop approach like spider ? Hope I'm not too ungrateful ;>

MG The stats are the roughest part of it, without a doubt; they were a fairly quick addition, as I recall, rather than a carefully planned feature. And it was written to be a clone of the Windows version, which is the reason for all the things you mentioned (inverse card effect, click to deselect, F10 for undo, green lines, and no drag-and-drop of cards). I don't have the time to make many changes to it at the moment, unfortunately, but it should only take a minute or two to change the undo binding and recolour the lines, if you wanted to. Changing the selected card effect and the click-to-deselect binding shouldn't be much work, either, I don't think, though it's been a while since I looked at the code in any real detail.

Steven Dec 24. Been playing Pysol this week. It has versions of Tktk, Tripeaks and a very nice Freecell. Haven't tested out the windows version, but they say it works fine. (It needs Python installed).


ChuckWinters - 2013-07-24 17:59:41

MG link above is dead, but works. MG Thanks, updated the link; I recently changed domain name.