August 31, 2006 Archives

Automatical Solitaire playing program

I've been working on an automatic solitaire playing program, that interfaces with Windows Solitaire.

To use it, launch Solitaire (it works with both the W2K and WXP versions of Solitaire, although currently it only does "deal one" and it can't cope with the Astronaut deck (because it doesn't have a black border)). Then press "Step" and it will play a single move, or "Run" and it will play for a maximum of 200 moves, or until it Resigns (after dealing 20 cards in a row with nothing else to do).

When it has finished, it will show a textual version of the game layout, and a log of the moves it made. In the text grid, C, D, H, S, stand for the four suits (Clubs, Diamonds, Hearts, and Spades respectively), R and B stand for unknown red or unknown black, and X, J, Q, and K, for 10, jack, queen, king, and so on. It isn't brilliant at detecting the suit of a card, but it doesn't (yet) use anything other than the colour and rank to work out moves.

Currently it plays using some fairly simple rules, so it will sometimes give up on winnable games. When it does win, it tends to complete the game in around 2 seconds, (Watching it play makes me ill, because the cards flicker around so much) however under the standard scoring scheme, the maximum bonus you can get is to complete in 30s (bonus = 700000/time if time >= 30). This gives a highscore of around 23833 (assuming 500 non-bonus points).

There are plent of bugs. e.g. It doesn't yet notice when it's won.

PlaySol.exe PlaySol.zip (includes runtime dlls) source


Posted by Robert Hart | Permanent Link | Categories: Computers