One of the reasons that Solitaire is so difficult to formulate, is the sheer number of possibilities involved in a single game. Just the total possible deals from a deck of 52 cards is a number the mind shudders at (52 factorial, or approximately 8 * 10^67). My first goal is to try and strip the game down to its barest essence, reducing permutations as far as possible while still maintaining the structure of the game. I will go into the specific variant of the game I am looking at later, there is enough to crack before we even get to the multitude of variations on the game.
Step 1, the most obvious step in reducing the problem complexity, is to start with a much reduced deck of cards. I need enough to get the effect of intermediate stacks. I am going to start with 4 cards per suit. A total of 16 cards still means about 20 trillion possible deals, but simulations and problem solving should be a lot easier.
My first approach is to treat Solitaire as a very lousy sorting algorithm, starting with 52 shuffled cards, and ending with all 4 suits in order, passing through an intermediate phase with the cards in rank order, alternating colours.
I want to assign a single value to each card, which, if possible, will allow a more mathematical approach. The lowest order component will represent the rank.
Ace = 1
Two = 2
and so forth, up to 4.
The next order component will represent the suit, and will be in the hundreds, to allow for more than ten ranks.
Spades = 100
Hearts = 200
Clubs = 300
Diamonds = 400
These are deliberately chosen so that odd numbers are the black suits and even numbers are red.
The last number I am debating adding is one to represent whether the card is face up or face down. This would perhaps mean adding 1000 to cards that are face down
So for instance, a face down two of hearts would be 1202.
I like the gratification of seeing the processing, so my first experimental program in C# is going to use a textgrid control, with a column for each stack.
Within the next 3 weeks or so I will open a project, either on SourceForge or Codeplex, and put my first “toy” program. This should allow for some playing around with parameters, and testing of initial ideas.