NOW LET US – AI RAG SaaS Studio TP.HCM
NOW LET US
Digital Product Studio
Back to news
DEV-TOOLS...2 min read

Solitaire simulator for finding the best strategy: Current record is 8.590%

Share
NOW LET US Article – Solitaire simulator for finding the best strategy: Current record is 8.590%

An open-source Solitaire simulator has reached a new winning record of 8.590% by optimizing move sequences, allowing users to test millions of games to find the best strategy.

  • 1.0

  • Very basic play using s2g, b2g, b2b, s2b only.

  • No effort to using smart alternatives.

  • For example | 9♠︎ | and | 9♣︎ | are both playable on | 10♥︎ |, but nothing but first encounter will choose one over the other.

  • 1.1

  • Play is the same as 1.0, but deck shuffling can be repeatable via the seed parameter.

  • 1.2

  • Play changed from {s2g, b2g, b2b, s2b} to {s2g, b2b, b2g, s2b} sequencing. Winning percentage increased from 7.915% to 8.590%.

  • run ant

  • Using Apache Ant to build project with default build.xml.

  • Targets are "clean" and "compile.java". Default runs both.

  • Using Apache Ant to build project with default build.xml.

  • run java -jar simulator.jar

  • usage: [--one|--three] [--attempts #] [--debug] [--seed #]

--one

: Turn only one card each play.--three

: Turn three cards each play.--attempts

: Number of games to attempt.--debug

: Verbose output about each game.--seed

: Random seed for repeatable play.

  • For example: java -jar simulator.jar --three --attempts 10 --seed 1111 > debug.out 2> debug.err

  • Run java with the simulator jar.

  • Turn three cards for each turn.

  • Play ten games.

  • Shuffle the deck starting with the seed 1111.

  • Write standard output to debug.out.

  • Only winning games will be output.

  • Write standard error to debug.err.

  • Without the debug switch, only errors will be output. With debug, all games are output.

  • usage:

  • run java -jar simulator.jar --three --attempts 1000000 --seed 1111

to determine your success rate verses the current record.- One million games takes less than an hour (without debug) on M2 MacBook Air.

  • |•A♦︎•|: Ace of Diamonds face down.

  • | A♦︎ |: Ace of Diamonds face up.

  • b2b: from Board to Board

  • b2g: from Board to Goal

  • g2b: from Goal to Board

  • s2b: from Stack to Board

  • s2g: from Stack to Goal

Output from a no parameter run:

`usage: [--one|--three] [--attempts #] [--debug] [--seed #] --one: Turn only one card each play. --three: Turn three cards each play. --attempts: Number of games to attempt. --debug: Verbose output about each game. --seed: Random seed for repeatable play. running: turn 3 cards and 10 attempts without debug without a seed Game 0 of 10 Game 1 of 10 Game 2 of 10 Game 3 of 10 Game 4 of 10 Game 5 of 10 Game 6 of 10 Game 7 of 10 Game 8 of 10 ================== WINNER ================== ~~~~~~~~~~~~~~~~~~ ~~~ Ready to Play ~~~~~~~~~ ====================== === Goal ============= ====================== === Board ============ | A♣︎ |

© 2026 Now Let Us. All rights reserved.

Source: Hacker News

Advertisement
Ad slot ready: 5887729102

More in this category

EXPLORE TOPICS

Discover All Categories

Deep dive into the specific technology sectors that matter most to you.