If you like this site, I would appreciate a gift from my wishlist.

Black Hole Solitaire Solver

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

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 solver is original work and is subject to the terms of the MIT/X11 licence, which is a Public Domain-like open-source licence.

News

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:


Become master of latest technology with our testking SY0-201 online course. Download the testking 642-813 tutorials and testking 70-680 study guide for easy learning.