As of October, 2016, Embarcadero is offering a free release
of Delphi (Delphi
10.1 Berlin Starter Edition ). There
are a few restrictions, but it is a welcome step toward making
more programmers aware of the joys of Delphi. They do say
"Offer may be withdrawn at any time", so don't delay if you want
to check it out. Please use the
link to let me know if the link stops working.
Support DFF - Shop
If you shop at Amazon anyway, consider using
this link. We receive a few cents from each purchase.
Support DFF - Donate
If you benefit from the website, in terms of
knowledge, entertainment value, or something otherwise useful,
consider making a donation via PayPal to help defray the
costs. (No PayPal account necessary to donate via credit
card.) Transaction is secure.
e-mail with your comments about this program (or anything else).
Write a program which allows users and the program to search for solutions to
the game of Accordion Solitaire.
Background & Techniques
Accordion Solitaire is a solitaire card game
for those who believe that the
journey is more important than the destination. Winning is very difficult,
probably less than 1 in 100 unless some strategy is applied. Using the
"Sweeper" strategy and examining all possible end-games for the last 12 moves,
the program can win 10% to 20% of the time.
Here are the rules:
Cards are dealt out one in a row, from left to right. Whenever a card matches
its immediate neighbor to the left, or matches the third card to the left, it
may be moved onto that card. Cards match if they are of the same suit or same
rank. Game play continues until the deck runs out and the game is won if you can
reduce the entire played deck to a single pile. Since no moves are mandatory,
there's no disadvantage (and may be an advantage) to deal all the cards first
and then make moves.
This program allows manual play and automates several strategies for program
play. Manual (user) play is an option implemented by clicking on a source pile
and then a valid destination pile.
For "program play", the program searches for a solution, Options are:
|... "Random" randomly selects one of the available valid moves for the
currently available visible cards.|
|... "Highest first" selects the move using the rightmost valid move
|... "Sweepers" uses a strategy described on web page
http://www.semicolon.com/Solitaire/Articles/Accordion.html where a
particular card rank that appears near the end of the displayed cards is
selected as the "sweeper" value and the 4 cards with that value are moved
whenever possible and are not overlaid until the end game.|
|... "Sweepers with Heuristics" applies additional rules to improve the
sweeper strategy. Currently there is only a single rule; to reduce end game
time, the search is aborted when there is no matching suit or rank for any
The "end game"requires some thought or the ability try lots of
moves very fast. Computers are poor thinkers but can try things very rapidly, so
this program uses an "exhaustive search" (try all possible moves) technique for
the end game. It works for the last 15 or fewer moves. If more than 15 piles
remain, then trying all possible moves would require minutes, hours, days,
years, or centuries depending on the number of piles remaining.
For computational speed, the "auto-play" options do not display card images but
use textual card identifiers (1-S for Ace of Spades, etc.)
Non-programmers are welcome to read on, but may want to jump to bottom of
this page to download the executable program now.
Running/Exploring the Program
Suggestions for Further Explorations
||Additional heuristic rules.
||Additional options for selecting "sweeper"
|Original: mmmm dd, yyyy
February 18, 2016