Program
What the program is
The program, Bill's Solitaire Tester, reproduces a game of Windows Solitaire. At each step in the game all possible legal moves are determined. Each of these moves are categorized and then prioritized according to a logic table. The best move is then made, and so on until the game is over.
What the program isn't
The program isn't very sophisticated. It does not "remember" cards that have previously been dealt from the deck in that it does not use this information to make decisions about subsequent moves. Nor does it "peek" under the dealt dealt stack to see the cards just dealt. In the Windows version of Solitaire a human player can do this. It has no artificial intelligence - it has no means of changing it's strategy based on previous results.
It should go without saying, but the tool does not cheat in any way or form. Unlike you or me though, it doesn't make silly mistakes.
The interface:
Download
Version 4.0 is available for download as an executable in a zip file
Version History
Version 4 (July 2011)
I discovered Microsoft VB 2010 Express in June 2011, and finally made the big move away from Visual Basic 6 to the VB Net framework. Converting the program to this new language gave me a really good excuse critically go through every line of code.
I started from a completely blank page with the initial objective of just concentrating on playing the game as fast as possible – so no graphics at all. The initial results were staggering. I was seeing up to 5000 games being played every second – up from 150 or so with the old VB6 version. This improvement was due far more to poor code in the old program than any intrinsic speed advantage of VB Express (which is not inconsiderable of itself).
The next step was to slowly add back in all of the “pretty” bits of the coding in such a way that the option to play at max speed was not compromised. This has now been successfully achieved, and V4.0 has pretty much all the functionality of V3.6 but with the ability to run at an incredibly fast speed to test out the different logic strategies. The logic has also been improved and the user now has more options to discriminate between moves of equal priority.
New for 3.6:
After doing some research about how the Visual Basic RND() random number generator works (and being mortally horrified by what I found out), I have now switched to using a method called the "Mersenne Twister" to generate random numbers to shuffle the deck before each game. The reason for this was: the intrinsic VB random number generator repeats the number sequence every 16.77 million numbers due to its crude algorithm; and the Mersenne Twister (apart from just sounding incredibly cool) - doesn't (more details here). Anyway, after implementing this tweak, the results didn't really change and since it didn't add any significant run time it's going to stay.
New features now available in V3.5 include:
-
Option available to output results to a text file
-
Can now save every deck played and the result in a text file
-
Added option to go round deck twice only (later removed in V4.0)
Updates included in V3.4:
-
Turbo mode - super fast no display of anything other than totals until all games are done
-
Option to save the deck which resulted in the fewest number of moves to achieve a win
-
Many more logic choices based on a detailed analysis of which kinds of moves are encountered during a game
Features inherited from previous versions:
-
All possible moves are listed at each step of the game
-
User can now play the game manually with the mouse, so you can play a game entirely without using the tool logic if you wish
-
The option is now available to save and load individual games and logic selections
-
Snapshots of the individual table layouts or sequences through a game can be saved as bitmaps
-
Animation of the card moves can be enabled
-
Option to play with a sorted deck (Ace clubs, 2 clubs, 3 clubs etc)
-
The frequency of occurrence of the different possible move types is recorded and displayed
-
Multiple play option allows you to play a large number of games using a pre-selected logic hierarchy to determine which moves to make when offered a choice of moves
-
Can show each card move, or just the deal and end game position, or no moves at all to speed up play
-
Can vary speed of play
-
Can use completely random decks of cards for each game, or use the same default sequence of random decks
-
User can vary the priority of each of the types of moves or deselect them entirely