Command Line Solitaire

For those who prefer playing Solitaire in Terminal.

Cards are written with the value first (1–2 letters) and the suit last: H heart, C club, S spade, D diamond. For example, 10S is the 10 of spades, and QH is the queen of hearts. Text you type in the command line is not case-sensitive.

Enjoy solitaire-y confinement.

View code on GitHub


      

Computer players

Player

56.8% win rate (1,000 games played)

Player cannot see cards that are not flipped over. It tries several possible layouts for the hidden cards and picks the move that wins most often.

Warp

80.8% win rate (1,000 games played)

Warp can see the face-down cards and hidden stock, and it uses that knowledge to pick a move. While Warp is playing, face-down tableau cards are shown.

In the terminal, type player or warp to activate a computer player.

Win rates are completed wins on this 1-card-draw Solitaire ruleset, not generic Klondike. The test used 1,000 random deals, seeds 1–1000, shuffled with Java’s Random.