Solve and automatically play Pyramid or TriPeaks Solitaire. Watch the demonstration video for getting started and solving TriPeaks Solitaire, or the demonstration video for Pyramid Solitaire. The latest release for Windows 10 for download is version 2.6.10. This requires that you install a 64 bit JRE 11 first.
This program has been in "maintenance mode" for several years now, with updates as new versions of Microsoft Solitaire Collection are released. But now the game comes with its own solver, but I'm still interested in maintaining and enhancing this program as I think it's interesting from a programming perspective. I just haven't really had time to spend on it yet.
Some things I'd like to figure out:
solitaire-player is a Java program that can quickly find an optimal solution to Pyramid or TriPeaks Solitaire for any deck of cards you give it, if a solution exists. Also, it can automatically play Pyramid and TriPeaks Solitaire in Windows 10's Microsoft Solitaire Collection.
The following performance measurements were done on an Intel i7-4770k CPU (3.5GHz, 3.9GHz max) running Windows 10. They measure the time it takes to find a solution given a deck of cards, but do not include the time it takes to play the game.
Here are timings for clearing the board on 1500 random decks of cards. 502 of them have no possible way to clear the board and the timing measurement is how long the program takes to find out there's no solution.
Decks | Mean (ms) | Median (ms) | Maximum (ms) | Total (hrs:min:sec) |
---|---|---|---|---|
1500 random decks | 598 | 156 | 33093 | 0:14:56 |
998 solvable decks | 296 | 157 | 4547 | 0:04:55 |
502 unsolvable decks | 1198 | 47 | 33093 | 0:10:01 |
Here are timings for finding out how to get the maximum possible score on the same 1500 random decks.
Decks | Mean (ms) | Median (ms) | Maximum (ms) | Total (hrs:min:sec) |
---|---|---|---|---|
1500 random decks | 6224 | 3804 | 76331 | 2:35:36 |
Here are timings for finding out how to remove as many Aces as possible from the game. It will find out the best possible solution while clearing the board, and the best solution which does not clear the board, and compare them.
Decks | Mean (ms) | Median (ms) | Maximum (ms) | Total (hrs:min:sec) |
---|---|---|---|---|
1500 random decks | 6198 | 3610 | 67427 | 2:34:57 |
Here are timings for clearing the board on the same 1500 random decks. 43 of them have no possible way to clear the board and the timing measurement is how long the program takes to find out there's no solution.
Decks | Mean (ms) | Median (ms) | Maximum (ms) | Total (hrs:min:sec) |
---|---|---|---|---|
1500 random decks | 111 | 109 | 329 | 0:02:46 |
1457 solvable decks | 111 | 109 | 329 | 0:02:42 |
43 unsolvable decks | 81 | 93 | 125 | 0:00:04 |
Here are timings for trying to get a relatively high score on the same 1500 random decks. It doesn't guarantee the best possible score.
Decks | Mean (ms) | Median (ms) | Maximum (ms) | Total (hrs:min:sec) |
---|---|---|---|---|
1500 random decks | 366 | 360 | 734 | 0:09:09 |
Here are timings for finding out how to remove as many Aces as possible from the board on the same 1500 random decks.
Decks | Mean (ms) | Median (ms) | Maximum (ms) | Total (hrs:min:sec) |
---|---|---|---|---|
1500 random decks | 109 | 109 | 360 | 0:02:43 |
solitaire-player.bat Pyramid
solitaire-player.bat Pyramid Board
solitaire-player.bat Pyramid Score
solitaire-player.bat Pyramid Score <goal score> <current score>
solitaire-player.bat Pyramid Card <number of cards to remove> <card rank to remove> <current cards of that rank removed>
The TriPeaks options are basically the same as Pyramid but with the word TriPeaks in place of Pyramid:
solitaire-player.bat TriPeaks
solitaire-player.bat TriPeaks Board
solitaire-player.bat TriPeaks Score
solitaire-player.bat TriPeaks Score <goal score> <current score>
solitaire-player.bat TriPeaks Card <number of cards to remove> <card rank to remove> <current cards of that rank removed>
In Pyramid Solitaire, we know the entire deck of cards because we can flip through the stock pile and see what they are, then restart the game. But in TriPeaks, 18 of the cards are stuck face-down until we play the game and uncover them. This program starts off by scanning through the cards in the stock pile and undoing the game, but then in TriPeaks, it will play to flip over face down cards until it knows enough of the deck to reach the goal or otherwise turn over all the cards.
It will start off showing the deck using ?? to represent unknown cards:
?? ?? ??
?? ?? ?? ?? ?? ??
?? ?? ?? ?? ?? ?? ?? ?? ??
7h 3d 7d Ah 9h 5c Td Ac 2h 7c
8h
As 9d Ad 4s Jc 2d 7s Jh 4d Kd 9c 8d 5s 2c 4h Qd Ts 5d 4c Ks 6c Tc 3s
As it plays the game to reveal the unknown cards, keep verifying the new face up cards, but don't delete the ones that are removed from the game - it's just trying to figure out the entire deck before it restarts the game and plays the solution from the beginning.
Pyramid Solitaire:
6d
5h Ah
Jd 4s Ks
6s 8c 2h 4d
9s Kd 6c Ad 8s
Ac 5c 9d 7h 3h 8d
5s 4c Qc Jh Kc Kh 3c
3s 9c As 5d Qh Ts 4h 7s Td 9h Th 7c 8h 2c 7d Tc 2d 6h 2s Js Qd 3d Qs Jc
In the example above, the 3s is the initial card at the top of the stock pile and the Jc is the bottom of the stock pile.
TriPeaks Solitaire:
Jd Qs 5h
3c 6h 6s 8s 6d Qc
Js Qh Kc Kh 9s 3h 2s Th 8c
7h 3d 7d Ah 9h 5c Td Ac 2h 7c
8h
As 9d Ad 4s Jc 2d 7s Jh 4d Kd 9c 8d 5s 2c 4h Qd Ts 5d 4c Ks 6c Tc 3s
In the example above, 8h is the cart initially at the top of the waste pile, As is the first face-down card at the top of the stock pile and 3s is the bottom.
Steps for automatically playing Pyramid or TriPeaks Solitaire
instructions, except in step 5, always add -f <filename>
to give the program the deck of cards to solve. It will skip any automation and just print out the solutions it finds. For both Pyramid and TriPeaks Solitaire, the file must know all the cards.This is a standard gradle project so you can run things like "gradlew distZip" and run the program using the distribution. There is also a Programming Guide with details for developers.