If you like this site, see my recent campaign for collecting money for my works of fiction.

Black Hole Solitaire Solver

This is a solver, written in C, to solve the Solitaire variant called “Black Hole” and the one called “All in a Row”. It provides a portable C library, and a command line application that after being fed with a layout will emit the cards to move.

Download

Solving Data

We’ve ran the solver on the first 1 million PySolFC Black Hole Solitaire deals and one can download the data from that as a compressed textual dump of an SQLite database.

Here’s a description of the tables of the database:

  1. bhs_runs - this table contains the results and statistics of running the solver on the boards. Its columns are:

    1. idx - the index of the PySolFC deal.
    2. status - a character representing the verdict - ‘U’ for unsolved, ‘S’ for solved.
    3. num_checked - the number of iterations that were checked (“num_times”). If the game was unsolved, then it will be equal to num_generated (see below).
    4. num_generated - the number of states generated (and not necessarily checked). May only be different if the deal was solved.
  2. bhs_solutions - this table contains the compacted solutions for the solved boards. Its columns are:

    1. idx - the index of the deal (that must be ‘S’ on “bhs_runs”).
    2. solution - this is the compacted solution. The 0,2,4 etc. characters are the indices of the stacks moved in the range 1-17. The 1,3,5 etc. characters are the corresponding moved cards after calculating chr(1 + $suits_to_n{$s} * 13 + $ranks_to_n{$r}) where the suits are ordered H,C,D,S. It will total 51*2 characters. Here’s the script that was used to generate them from the more verbose solution files.

Similar Projects

Licence

The Black Hole Solitaire Solver is free and open-source software (FOSS) distributed under the MIT/X11 License, a permissive, public-domain-like, software licence.

News

Version 0.10.0

Version 0.10.0 of Black Hole Solitaire Solver was released. The highlights of this release are the new --display-iters-step flag, which allows for monitoring the progress of the solutions, and fixes for the build system with version 3.0.0 of CMake.

Version 0.8.0

Version 0.8.0 of Black Hole Solitaire Solver was released. The highlights of this release are the new --version flag, and the --rank-reach-prune flag, which can improve performance.

Version 0.6.0

Version 0.6.0 of Black Hole Solitaire Solver was released. The highlights of this release are the inclusion of the NEWS file, the --help flag and most importantly the --display-boards flag that displays the intermediate board layouts after every move.

Version 0.4.0

Version 0.4.0 of Black Hole Solitaire Solver was released. The highlight of this release is the fact that it can now also solve All in a Row solitaire. As a result of this effort, we have run the solver on the first 1 million PySolFC deals of All in a Row Solitaire and have drawn some conclusions:

Version 0.2.0

Version 0.2.0 of Black Hole Solitaire Solver was released. The highlight of this release is the porting of the solver from Perl to C which yields a very dramatic gain in speed and memory consumption. As a result of this effort, we have run the solver on the first 1 million PySolFC deals of Black Hole Solitaire and have drawn some conclusions: