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):

  1. Deck Ace to Suit Pile

  2. Table Ace to Suit Pile

  3. Deal Deck if no Deck Card visible

  4. Turn over hidden Table Card

  5. Table King to empty space

  6. Table card column with hidden card to visible card on another column

  7. Deck King to Table

  8. Non-Ace or King Deck Card to table

  9. Non-Ace Table Card to Suit Pile; no King move consideration

  10. Split columns to allow a move to Suit Pile

  11. Non-Ace single Table Card, no hidden card, to Suit Pile, king move not needed

  12. Non-Ace Deck Card to Suit Pile

  13. Table Card to Suit Pile to allow Deck Card to go to Suit Pile

  14. Suit Pile card to Table so Deck Card can move

  15. Suit Pile card to Table so Table Card can turn over

  16. Deal Deck if Deck Card already visible

  17. Flip Deck

  18. 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.