Logic
At each step in the game all possible legal moves are determined. Each of these moves are categorized and then prioritized according to a predefined list. The best move is then made, and so on until the game is over.
To optimize the play strategy, I have varied the priorities of the different move categories to maximize the occurrence of clearing the table. Much trial and error went into coming up with the final default move category priority list.
The different categories of moves that are identified, and the priority in which they are applied are as follows (the links take you to a screen shot showing an example of where this kind of logic is applied):
-
Table card column with hidden card to visible card on another column
-
Non-Ace single Table Card, no hidden card, to Suit Pile, king move not needed
-
Table Card to Suit Pile to allow Deck Card to go to Suit Pile
-
Table Card with no hidden card to another column, no king move needed
In a situation where 2 or more moves of the same category are possible at the same time, in some instances, the logic in the program attempts to discriminate between those moves. In those cases, preference is given to the move that is made from the column with the greatest number of hidden cards. The categories that this applies to are 5 and 6 in the previous list.
Below is a screenshot of the Logic selection and reporting screen. The frequency numbers relate to a session of 100,000 games.