Freecell-App
view release on metacpan or search on metacpan
bin/freecell-solver view on Meta::CPAN
The algorithm is simple.
=over 4
=item * Start with 64.
=item * Subtract the rank of all the top home cards.
=item * Subtract 1 for each empty freecell and empty column.
=item * Add 1 for each sequence break in the cascade
e.g. 6C 5H 4S 2C KD QS TH has 3 sequence breaks,
one major at 2C because the KD is greater than
the 2C.
=back
Before the search of the next level, the nodes to be search are sorted by
their score and only the top maxnodes qualify for the next search and all
the remaining nodes are deleted from the position hash.
lib/Freecell/App/Tableau.pm view on Meta::CPAN
none.
=head1 SUBROUTINES/METHODS
=head2 new()
Initializes the Tableau with 8 columns and 21 rows of 0's
columns 0 .. 3 row 0 are the freecells
columns 4 .. 7 row 0 are the homecells D, C, H, S
columns 0 .. 7 rows 1 .. 20 are the cascades
=head2 from_token()
This creates a Tableau from the Key and Token built in C<to_token()>.
=head2 to_token()
The key for position is created with C<to_token()> which also creates a
token array. The token array is needed to rebuild the Tableau from the key.
The key is the chr() of each integer in the Tableau.
lib/Freecell/App/Tableau.pm view on Meta::CPAN
The algorithm is simple.
=over 4
=item * Start with 64.
=item * Subtract the rank of all the top home cards.
=item * Subtract 1 for each empty freecell and empty column.
=item * Add 1 for each sequence break in the cascade
e.g. 6C 5H 4S 2C KD QS TH has 3 sequence breaks,
one major at 2C because the KD is greater than
the 2C.
=back
=head2 helper subroutines
=over 4
( run in 0.952 second using v1.01-cache-2.11-cpan-bb97c1e446a )