Games::Solitaire::Verify::VariantsMap - a mapping from the variants to


Games-Solitaire-Verify documentation Contained in the Games-Solitaire-Verify distribution.

Index


Code Index:

NAME

Top

Games::Solitaire::Verify::VariantsMap - a mapping from the variants to their parameters.

VERSION

Top

Version 0.03

FUNCTIONS

Top

$self->calc_variants_map()

Returns the variants map - a hash reference mapping the variant ID to its parameters.

my $variant_params = $self->get_variant_by_id($id)

Returns the variant from its ID or undef if it does not exist.

PARAMETERS

Top

Variants IDs

This is a list of the available variant IDs.

* bakers_dozen
* bakers_game
* beleaguered_castle
* cruel
* der_katzenschwanz
* die_schlange
* eight_off
* fan
* forecell
* freecell
* good_measure
* kings_only_bakers_game
* relaxed_freecell
* relaxed_seahaven_towers
* seahaven_towers
* simple_simon

SEE ALSO

Top

Games::Solitaire::Verify::VariantParams .

AUTHOR

Top

Shlomi Fish, <shlomif at iglu.org.il>

BUGS

Top

Please report any bugs or feature requests to bug-games-solitaire-verifysolution-move at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-Solitaire-Verify. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Games::Solitaire::Verify::VariantsMap




You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Games-Solitaire-Verify

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Games-Solitaire-Verify

* CPAN Ratings

http://cpanratings.perl.org/d/Games-Solitaire-Verify

* Search CPAN

http://search.cpan.org/dist/Games-Solitaire-Verify

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


Games-Solitaire-Verify documentation Contained in the Games-Solitaire-Verify distribution.
package Games::Solitaire::Verify::VariantsMap;

use strict;
use warnings;

require Games::Solitaire::Verify::VariantParams;

use base 'Games::Solitaire::Verify::Base';

our $VERSION = '0.0901';

sub _init
{
    return 0;
}

my %variants_map =
(
    "bakers_dozen" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 13,
                'num_freecells' => 0,
                'sequence_move' => "limited",
                'seq_build_by' => "rank",
                'empty_stacks_filled_by' => "none",
            }
        ),
    "bakers_game" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 8,
                'num_freecells' => 4,
                'sequence_move' => "limited",
                'seq_build_by' => "suit",
                'empty_stacks_filled_by' => "any",
            }
        ),
    "beleaguered_castle" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 8,
                'num_freecells' => 0,
                'sequence_move' => "limited",
                'seq_build_by' => "rank",
                'empty_stacks_filled_by' => "any",
            }
        ),
    "cruel" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 12,
                'num_freecells' => 0,
                'sequence_move' => "limited",
                'seq_build_by' => "suit",
                'empty_stacks_filled_by' => "none",
            }
        ),
    "der_katzenschwanz" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 2,
                'num_columns' => 9,
                'num_freecells' => 8,
                'sequence_move' => "unlimited",
                'seq_build_by' => "alt_color",
                'empty_stacks_filled_by' => "none",
            }
        ),
    "die_schlange" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 2,
                'num_columns' => 9,
                'num_freecells' => 8,
                'sequence_move' => "limited",
                'seq_build_by' => "alt_color",
                'empty_stacks_filled_by' => "none",
            }
        ),
    "eight_off" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 8,
                'num_freecells' => 8,
                'sequence_move' => "limited",
                'seq_build_by' => "suit",
                'empty_stacks_filled_by' => "kings",
            }
        ),
    "fan" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 18,
                'num_freecells' => 0,
                'sequence_move' => "limited",
                'seq_build_by' => "suit",
                'empty_stacks_filled_by' => "kings",
            }
        ),
    "forecell" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 8,
                'num_freecells' => 4,
                'sequence_move' => "limited",
                'seq_build_by' => "alt_color",
                'empty_stacks_filled_by' => "kings",
            }
        ),
    "freecell" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 8,
                'num_freecells' => 4,
                'sequence_move' => "limited",
                'seq_build_by' => "alt_color",
                'empty_stacks_filled_by' => "any",
            }
        ),
    "good_measure" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 10,
                'num_freecells' => 0,
                'sequence_move' => "limited",
                'seq_build_by' => "rank",
                'empty_stacks_filled_by' => "none",
            }
        ),
    "kings_only_bakers_game" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 8,
                'num_freecells' => 4,
                'sequence_move' => "limited",
                'seq_build_by' => "suit",
                'empty_stacks_filled_by' => "kings",
            }
        ),
    "relaxed_freecell" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 8,
                'num_freecells' => 4,
                'sequence_move' => "unlimited",
                'seq_build_by' => "alt_color",
                'empty_stacks_filled_by' => "any",
            }
        ),
    "relaxed_seahaven_towers" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 10,
                'num_freecells' => 4,
                'sequence_move' => "unlimited",
                'seq_build_by' => "suit",
                'empty_stacks_filled_by' => "kings",
            }
        ),
    "seahaven_towers" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 10,
                'num_freecells' => 4,
                'sequence_move' => "limited",
                'seq_build_by' => "suit",
                'empty_stacks_filled_by' => "kings",
            }
        ),
    "simple_simon" =>
        Games::Solitaire::Verify::VariantParams->new(
            {
                'num_decks' => 1,
                'num_columns' => 10,
                'num_freecells' => 0,
                'sequence_move' => "limited",
                'seq_build_by' => "suit",
                'empty_stacks_filled_by' => "any",
                'rules' => "simple_simon",
            }
        ),
);

sub calc_variants_map
{
    my $self = shift;

    return \%variants_map;
}

sub get_variant_by_id
{
    my $self = shift;
    my $id = shift;

    my $map = $self->calc_variants_map();

    if (!exists($map->{$id}))
    {
        return;
    }
    else
    {
        return $map->{$id}->clone();
    }
}

1;