fc-solve / fc-solve / site / wml / src / faq.html.wml

Shlomi Fish 68aa992 















Shlomi Fish 60fb3af 
Shlomi Fish 68aa992 







Shlomi Fish 60fb3af 






























Shlomi Fish 7ccce47 
































Shlomi Fish cc24128 











































































Shlomi Fish 4382651 





Shlomi Fish 7322e5f 
Shlomi Fish 0de678b 
Shlomi Fish 4382651 


#include '../template.wml'

<latemp_subject "The Freecell Solver Frequently Asked Questions (F.A.Q.) List" />

<h3 id="a_move_seems_wrong">I think I found a wrong move in the solution? What can I do?</h3>

<p>
While it is not unthinkable that Freecell Solver will have a bug and will
make a wrong move, it is extremely unlikely that that is the case. Some people
have reported that several multi-sequence moves are impossible, but as I
demonstrated to them, they were in fact possible.
</p>

<p>
One can find the maximal number of cards that can be moved as a sequence
in Freecell using the formula
<tt>max_cards = (1 + num_vacant_freecells) * (2 ^ num_vacant_columns)</tt>
(where “*” is multiplication and “^” is exponentiation.). One can also try using
<a href="https://metacpan.org/module/expand-solitaire-multi-cards-moves">expand-solitaire-multi-cards-moves</a>
from the <a href="https://metacpan.org/release/Games-Solitaire-Verify">Games-Solitaire-Verify CPAN distribution</a> (by the same author of Freecell Solver),
in order to filter solutions and produce ones with multi-card moves
expanded into many single-card moves. If you are on Microsoft Windows, you can
install <a href="http://dwimperl.com/">DWIM Perl</a> and run it.
</p>

<h3 id="abuse_of_fc_solve">I think I found an abuse of Freecell Solver. What should I do?</h3>

<p>
We received a report or two about various people or companies distributing
Freecell Solver along with their products, and the answer is that it is:
1. Likely legal, 2. We don't mind, and 3. We encourage commercial and/or
proprietary use of the code or binaries.
</p>

<p>
Freecell Solver used to be distributed under the Public Domain, but was
relicensed to the permissive
<a href="http://en.wikipedia.org/wiki/MIT_License">MIT/X11 licence</a> due
to the problematic and not globally accepted nature of the Public Domain,
especially in software. (See
<a href="http://linuxmafia.com/faq/Licensing_and_Law/public-domain.html">the
page maintained by Rick Moen about it</a>.) As far as we know (and this is
not legal advice), the main legal and practical
difference between the public domain and the X11 licence, is that one should
keep attributing the original copyright holders as rightful holders (while
the licence of derivative works may be changed into any other). As far as
we are concerned, this is not something we want to enforce, but we still
recommend to follow this, to stay on the safe side of the law.
</p>

<p>
So unless someone sues us for damages for a problem caused by the program
or library (which violates the no warrany paragraph of the licence) everything
should be fine and the “abuse” of the program is acceptable.
</p>

<h3 id="what_are_the_uses_of_a_solver">What are the uses of a solver for Patience, such as Freecell Solver?</h3>

<p>
Freecell Solver is unlikely to help in curing cancer, or solve world hunger,
but it still has some uses. One use is determining whether an initial layout
of a game, or a layout in mid-play is solvable or not so a human player can
know whether he needs to return to an earlier position. The default
configuration of Freecell solver may still report a small number of solvable
positions as unsolved, but that can be mitigated by passing some command-line
flags.
</p>

<p>
Another use of a Solitaire solver is to find solutions for difficult deals,
or attempt to find shorter solutions. Yet another use is to collect statistics
from a large number of random deals (say, the Microsoft Windows Freecell deals
or PySolFC’s deals), which is part of what Freecell researchers do.
</p>

<p>
The Freecell implementation for Windows, Freecell 3D has also introduced a
“Race against the computer” mode of Freecell, which is an interesting challenge.
</p>

<p>
Finally, we have more recently started to investigate some “human/computer
collaborated” Freecell solving, where a human aided by a Solitaire suite with
good solver integration can attempt to solve some difficult deals (for both a
human and a computerised solver), by pruning dead ends, and by finding whether
reached states are solvable. This provides a combined solving power, that is
greater than the sum of both parts.
</p>

<h3 id="new_solver_is_too_slow">I Started Writing a Freecell Solver (of my own) but it is too slow. What can I do?</h3>

<p>
The problem with many naïve Freecell solving solutions is that, while they
can succeed in solving many Freecell deals, they may fail spectacularly in
the general case. Furthermore, Generalised Freecell (where there is an
arbitrary number of ranks) was shown to be
an <a href="http://en.wikipedia.org/wiki/NP-complete">NP-complete problem</a>
and as a result, it is unlikely that no efficient solution for solving that
can be found.
</p>

<p>
You can try inspecting the code of Freecell Solver or one of the
<a href="$(ROOT)/links.html#other_solvers">other solvers</a> for insights, but
note that their code (and especially Freecell Solver's) may be somewhat
complex, and hard to understand for people with relatively little experience.
You can also pursue some of the
<a href="$(ROOT)/docs/">Freecell Solver documentation</a> as well as the
<a href="http://tech.groups.yahoo.com/group/fc-solve-discuss/">archives of
the fc-solve-discuss mailing list</a> for some insights and ideas.
</p>

<p>
Here is some general tips:
</p>

<ul>

<li>
<p>
Make sure that the positions in the graph of the game are represented as a
single segment of memory (normally a C struct) and can be compared for
equivalence easily (using memcmp() or a similar function).
</p>
</li>

<li>
<p>
Use an efficient data structure to hold the states in the collection such as
a hash table or a self-balancing binary tree.
</p>
</li>

<li>
<p>
Often randomising the solution (see Freecell Solver's Random-DFS scan
which was inspired by a different solver called Freecell Tool can help
a lot).
</p>
</li>

<li>
<p>
Freecell Solver makes heavy use of switch tasking: having several different
searches operate on the same board, until the first search yields a solution.
This normally yields a solution quicker than a singular scan.
</p>
</li>

<li>
<p>
Consider implementing moves as meta-moves: sequences of several single-card
and/or sequence moves that implement a certain ends. This can yield a solution
faster than using single-card moves (also known as atomic moves).
</p>
</li>

</ul>

<p>
Finally, note that we could use a helping hand with Freecell Solver, and the
authors of other open-source solvers may be happy for help as well, so if
you want to improve something more mature, then contact us.
</p>

<!--

TODO:

* May I integrate Freecell Solver into my program? And how?
* The solutions are too long. What can I do?
* Why is Freecell Solver written in C? Why not in another language?
* I found a solution that Freecell Solver erroneously reports as unsolveable - should I report it to you?

-->
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.