A Guide to the Accordion Virtuoso program

Accordion Virtuoso is a Windows program for playing the open version of the solitaire game Accordion.   A general description of the game, its variations, and its strategy can be found on the main Solitaire Laboratory site.    The program was inspired by Jason Crupper's program written in Scheme, and Andrew Pipkin's online Java version, but with many new enhancements and variations added.

Basic rules of Accordion

The deck is dealt out as an overlapped row of 52 cards.  Cards are played right to left: a card may be moved onto the card immediately to its left, or three cards to its left, if the two cards are of the same suit or rank.    The covered card becomes part of a pile, which moves in exactly the same manner as the card at the top of the pile.  Piles are shown as single cards for clarity.   The object of the game is to reduce the cards to one pile.   This can be done virtually 100% of the time.

Clicking with the left mouse button will make the card clicked slide (covering the card immediately to its left) if possible, or leap (moving to cover the card three cards to its left) if a leap is possible and a slide is not.    Clicking with the right mouse button will leap if possible.   Both clicks will have no effect if the desired move is not possible.   With a little practice, you will soon click easily (using mostly left clicks).  If you make a mistake, the Undo option will immediately take back your previous move (any number of consecutive moves may be undone).   A text box will keep track of how many undos you have used (this is for the player's information; there is no penalty).

By default, the program chooses a rank to act as sweepers, and highlights that rank to prevent it from being deleted accidentally.   The F8 key of the Parameters/ Protect Rank option will turn off the protected rank.  Clicking F8 again will turn the background dark brown; clicking on a card will then make that rank the new protected rank.  A protected card can also be covered by holding down the Alt key while left or right clicking.

The main text window shows the complete progress of the solution, using a simple notation (suggested by Jason Crupper) with the card and distance moved.

Variable Leap Values

The game is quite playable even if the leap size is increased from 3 to larger values.   A leap size of 2 is extremely difficult, but can sometimes be won.  The Parameter/Accordion Leap Size menu item allows any leap size from 2 to 12 to be chosen.


Here is a screenshot showing the Accordion game. The entire deck is fanned out from left to right. The program calculates a simple function to select the best rank to try as the sweeper rank: the best choice is shown in the lower left corner, in this case fours, which have a very low score of 14 (other ranks with low scores may be shown in the larger gray window directly below the cards; in this case the program finds no other good candidates). The program also shows which candidate is the first, counting from the right end, to have two, three, and all four of its rank appear. In this case fours appear twice, three times, and four times before every other rank. All four cards of the best candidate rank are highlighted, and they may not be discarded while highlighted (there is an option to turn off the highlighting or to choose a different rank). The fours of hearts and spades are already in ideal position; there is only one diamond behind the 4D and six clubs behind the 4C (so the evaluation function for fours is 1x1x2x7 = 14).

The program works on a single click system: a left mouse click sends the card you are clicking on either one (slide) or three cards (leap) to the left. If both moves are possible, it slides; a right mouse click automatically leaps if possible, doing nothing otherwise. This takes a little practice to get used to, but you can play pretty quickly once you are familiar with it. Highlighted cards can be moved (either slide or leap), but not discarded (another card cannot slide or leap onto them), which prevents you from accidentally discarding sweepers (highlighted cards can be discarded if you hold the Alt key down while clicking).

Accordion's Revenge

Mark Masten thought up and tested a harder version, which he called Accordion's Revenge. A card is selected from the 52 cards dealt, and the game has to be won with the selected card at the top of the pile at the end.



Playing without Slides

An interesting variation of the game is to play with leaps of 2 and 3, but no slides, attempting to reduce to 2 cards.  Right clicking while holding down the Control key momentarily decreases the leap value by 1, so this variant can be played using only the right mouse button and the Control key (otherwise you would have to toggle constantly between leap values). 

More features of Accordion Virtuoso

Two optional help features available to the player (both are off by default, but can be switched on and off at will from the options menus) are shown below, partway through a deal. The row of colored squares directly below the card show which cards can currently be played (AutoCount). Black squares show available slides, white squares leaps, and red squares show cards able to either slide or leap (showing available leaps is particularly helpful in long-leap games). The Card Tracker at the bottom right shows which cards have been covered, making it easy to see at a glance which cards of a particular suit or rank are still left. In addition, the program automatically signals when no more moves are available by turning the background blue; this AutoEnd feature is on by default and is independent of the AutoCount option.


I devised an easier version of Accordion, called Concertina, in which a card (or pile) on the right may, if desired, be placed underneath the card/pile one or three positions left; we will naturally call these moves underslides and underleaps (note that if both slide and leap are possible with the same card, underslide and underleap have the exact same effect).   To make the selected card move under the target card, hold the Shift key while left or right clicking (underplays are symbolized with plus signs instead of minus signs in the solution notation).   This works best with the extremely hard leap 2 game; other leap values are already winnable enough.   I do not know if any deals can be won with only underslides and underleaps.

Other variations

Mark Masten has also suggested using alternate decks, in particular a 49-card deck consisting of seven cards each of seven suits. Obviously it is possible to combine any of the above variations; in particular playing Accordion's Revenge with larger leap values makes a very challenging game.

Traditional Play

I have now incorporated an automatic solver for the traditional version of Accordion into the Accordion Virtuoso program. It makes every play possible (from left to right) after each card is dealt, and can either play slides in preference to leaps, or vice versa. I have run all of the daily deals (those numbered 1 to 86400, which are dealt randomly by the New Deal option depending on the second of the day) with both options. When playing leaps if both plays are available for the same card, 37 deals out of 86400 were won (about 1 in 2335). When playing slides first, 56 deals were won (about 1 in 1543); four deals (2071, 23197, 75566, and 76541) were won with both options. Deal 76541 is shown below, with 31 of the cards playable at the start (9 have a leap/slide option).   If all available plays are made from left to right, the deal is won.

It's harder than you think to play poorly -- Accordion Misère

Misère is a French term often used to refer to games played with an reversed object of play (such as lowball poker or giveaway chess).  In this case, what happens if we try to block ourselves and finish with as many cards as possible?     So far the best I have managed is 27 cards left in deal number 99042, which has only 11 playable cards at the start (note the blue background showing a blocked position):

Searching for hard deals

Computer searches for the deals with the fewest initial moves may prove a fruitful way to look for very hard deals.   A search through the first quarter of a million deals turned up a number of examples where only 11 cards are playable at the start.    Of these, 98175 and 243224 proved especially difficult to solve, and a few deals I have not yet solved, including 99042, shown above.

Most recently edited on April 16, 2009.
This article is copyright © 2009 by Michael Keller. All rights reserved.