| 1 | package Games::Solitaire::Verify::VariantsMap; | ||||||||||
| 2 | 19 | $Games::Solitaire::Verify::VariantsMap::VERSION = '0.2601'; | |||||||||
| 3 | 19 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 19 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 19 | ▶ | use Games::Solitaire::Verify::VariantParams (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 19 | ▶ | use parent 'Games::Solitaire::Verify::Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | |||||||||||
| 11 | sub _init | ||||||||||
| 12 | 277 | ▶ | { | ||||||||
|
Subroutine
_init: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 277 | return 0; | |||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | 19 | my %variants_map = ( | |||||||||
| 17 | "bakers_dozen" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 18 | { | ||||||||||
| 19 | 'num_decks' => 1, | ||||||||||
| 20 | 'num_columns' => 13, | ||||||||||
| 21 | 'num_freecells' => 0, | ||||||||||
| 22 | 'sequence_move' => "limited", | ||||||||||
| 23 | 'seq_build_by' => "rank", | ||||||||||
| 24 | 'empty_stacks_filled_by' => "none", | ||||||||||
| 25 | } | ||||||||||
| 26 | ), | ||||||||||
| 27 | "bakers_game" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 28 | { | ||||||||||
| 29 | 'num_decks' => 1, | ||||||||||
| 30 | 'num_columns' => 8, | ||||||||||
| 31 | 'num_freecells' => 4, | ||||||||||
| 32 | 'sequence_move' => "limited", | ||||||||||
| 33 | 'seq_build_by' => "suit", | ||||||||||
| 34 | 'empty_stacks_filled_by' => "any", | ||||||||||
| 35 | } | ||||||||||
| 36 | ), | ||||||||||
| 37 | "beleaguered_castle" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 38 | { | ||||||||||
| 39 | 'num_decks' => 1, | ||||||||||
| 40 | 'num_columns' => 8, | ||||||||||
| 41 | 'num_freecells' => 0, | ||||||||||
| 42 | 'sequence_move' => "limited", | ||||||||||
| 43 | 'seq_build_by' => "rank", | ||||||||||
| 44 | 'empty_stacks_filled_by' => "any", | ||||||||||
| 45 | } | ||||||||||
| 46 | ), | ||||||||||
| 47 | "cruel" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 48 | { | ||||||||||
| 49 | 'num_decks' => 1, | ||||||||||
| 50 | 'num_columns' => 12, | ||||||||||
| 51 | 'num_freecells' => 0, | ||||||||||
| 52 | 'sequence_move' => "limited", | ||||||||||
| 53 | 'seq_build_by' => "suit", | ||||||||||
| 54 | 'empty_stacks_filled_by' => "none", | ||||||||||
| 55 | } | ||||||||||
| 56 | ), | ||||||||||
| 57 | "der_katzenschwanz" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 58 | { | ||||||||||
| 59 | 'num_decks' => 2, | ||||||||||
| 60 | 'num_columns' => 9, | ||||||||||
| 61 | 'num_freecells' => 8, | ||||||||||
| 62 | 'sequence_move' => "unlimited", | ||||||||||
| 63 | 'seq_build_by' => "alt_color", | ||||||||||
| 64 | 'empty_stacks_filled_by' => "none", | ||||||||||
| 65 | } | ||||||||||
| 66 | ), | ||||||||||
| 67 | "die_schlange" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 68 | { | ||||||||||
| 69 | 'num_decks' => 2, | ||||||||||
| 70 | 'num_columns' => 9, | ||||||||||
| 71 | 'num_freecells' => 8, | ||||||||||
| 72 | 'sequence_move' => "limited", | ||||||||||
| 73 | 'seq_build_by' => "alt_color", | ||||||||||
| 74 | 'empty_stacks_filled_by' => "none", | ||||||||||
| 75 | } | ||||||||||
| 76 | ), | ||||||||||
| 77 | "eight_off" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 78 | { | ||||||||||
| 79 | 'num_decks' => 1, | ||||||||||
| 80 | 'num_columns' => 8, | ||||||||||
| 81 | 'num_freecells' => 8, | ||||||||||
| 82 | 'sequence_move' => "limited", | ||||||||||
| 83 | 'seq_build_by' => "suit", | ||||||||||
| 84 | 'empty_stacks_filled_by' => "kings", | ||||||||||
| 85 | } | ||||||||||
| 86 | ), | ||||||||||
| 87 | "fan" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 88 | { | ||||||||||
| 89 | 'num_decks' => 1, | ||||||||||
| 90 | 'num_columns' => 18, | ||||||||||
| 91 | 'num_freecells' => 0, | ||||||||||
| 92 | 'sequence_move' => "limited", | ||||||||||
| 93 | 'seq_build_by' => "suit", | ||||||||||
| 94 | 'empty_stacks_filled_by' => "kings", | ||||||||||
| 95 | } | ||||||||||
| 96 | ), | ||||||||||
| 97 | "forecell" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 98 | { | ||||||||||
| 99 | 'num_decks' => 1, | ||||||||||
| 100 | 'num_columns' => 8, | ||||||||||
| 101 | 'num_freecells' => 4, | ||||||||||
| 102 | 'sequence_move' => "limited", | ||||||||||
| 103 | 'seq_build_by' => "alt_color", | ||||||||||
| 104 | 'empty_stacks_filled_by' => "kings", | ||||||||||
| 105 | } | ||||||||||
| 106 | ), | ||||||||||
| 107 | "freecell" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 108 | { | ||||||||||
| 109 | 'num_decks' => 1, | ||||||||||
| 110 | 'num_columns' => 8, | ||||||||||
| 111 | 'num_freecells' => 4, | ||||||||||
| 112 | 'sequence_move' => "limited", | ||||||||||
| 113 | 'seq_build_by' => "alt_color", | ||||||||||
| 114 | 'empty_stacks_filled_by' => "any", | ||||||||||
| 115 | } | ||||||||||
| 116 | ), | ||||||||||
| 117 | "good_measure" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 118 | { | ||||||||||
| 119 | 'num_decks' => 1, | ||||||||||
| 120 | 'num_columns' => 10, | ||||||||||
| 121 | 'num_freecells' => 0, | ||||||||||
| 122 | 'sequence_move' => "limited", | ||||||||||
| 123 | 'seq_build_by' => "rank", | ||||||||||
| 124 | 'empty_stacks_filled_by' => "none", | ||||||||||
| 125 | } | ||||||||||
| 126 | ), | ||||||||||
| 127 | "kings_only_bakers_game" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 128 | { | ||||||||||
| 129 | 'num_decks' => 1, | ||||||||||
| 130 | 'num_columns' => 8, | ||||||||||
| 131 | 'num_freecells' => 4, | ||||||||||
| 132 | 'sequence_move' => "limited", | ||||||||||
| 133 | 'seq_build_by' => "suit", | ||||||||||
| 134 | 'empty_stacks_filled_by' => "kings", | ||||||||||
| 135 | } | ||||||||||
| 136 | ), | ||||||||||
| 137 | "relaxed_freecell" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 138 | { | ||||||||||
| 139 | 'num_decks' => 1, | ||||||||||
| 140 | 'num_columns' => 8, | ||||||||||
| 141 | 'num_freecells' => 4, | ||||||||||
| 142 | 'sequence_move' => "unlimited", | ||||||||||
| 143 | 'seq_build_by' => "alt_color", | ||||||||||
| 144 | 'empty_stacks_filled_by' => "any", | ||||||||||
| 145 | } | ||||||||||
| 146 | ), | ||||||||||
| 147 | "relaxed_seahaven_towers" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 148 | { | ||||||||||
| 149 | 'num_decks' => 1, | ||||||||||
| 150 | 'num_columns' => 10, | ||||||||||
| 151 | 'num_freecells' => 4, | ||||||||||
| 152 | 'sequence_move' => "unlimited", | ||||||||||
| 153 | 'seq_build_by' => "suit", | ||||||||||
| 154 | 'empty_stacks_filled_by' => "kings", | ||||||||||
| 155 | } | ||||||||||
| 156 | ), | ||||||||||
| 157 | "seahaven_towers" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 158 | { | ||||||||||
| 159 | 'num_decks' => 1, | ||||||||||
| 160 | 'num_columns' => 10, | ||||||||||
| 161 | 'num_freecells' => 4, | ||||||||||
| 162 | 'sequence_move' => "limited", | ||||||||||
| 163 | 'seq_build_by' => "suit", | ||||||||||
| 164 | 'empty_stacks_filled_by' => "kings", | ||||||||||
| 165 | } | ||||||||||
| 166 | ), | ||||||||||
| 167 | "simple_simon" => Games::Solitaire::Verify::VariantParams->new( | ||||||||||
| 168 | { | ||||||||||
| 169 | 'num_decks' => 1, | ||||||||||
| 170 | 'num_columns' => 10, | ||||||||||
| 171 | 'num_freecells' => 0, | ||||||||||
| 172 | 'sequence_move' => "limited", | ||||||||||
| 173 | 'seq_build_by' => "suit", | ||||||||||
| 174 | 'empty_stacks_filled_by' => "any", | ||||||||||
| 175 | 'rules' => "simple_simon", | ||||||||||
| 176 | } | ||||||||||
| 177 | ), | ||||||||||
| 178 | ); | ||||||||||
| 179 | |||||||||||
| 180 | |||||||||||
| 181 | sub calc_variants_map | ||||||||||
| 182 | 296 | ▶ | { | ||||||||
|
Subroutine
calc_variants_map: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 183 | 296 | my $self = shift; | |||||||||
| 184 | |||||||||||
| 185 | 296 | return \%variants_map; | |||||||||
| 186 | } | ||||||||||
| 187 | |||||||||||
| 188 | |||||||||||
| 189 | sub get_variant_by_id | ||||||||||
| 190 | 296 | ▶ | { | ||||||||
|
Subroutine
get_variant_by_id: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||
| 191 | 296 | my $self = shift; | |||||||||
| 192 | 296 | my $id = shift; | |||||||||
| 193 | |||||||||||
| 194 | 296 | my $map = $self->calc_variants_map(); | |||||||||
| 195 | |||||||||||
| 196 | 296 | ▶ | if ( !exists( $map->{$id} ) ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 197 | { | ||||||||||
| 198 | 0 | return undef; | |||||||||
| 199 | } | ||||||||||
| 200 | else | ||||||||||
| 201 | { | ||||||||||
| 202 | 296 | return $map->{$id}->clone(); | |||||||||
| 203 | } | ||||||||||
| 204 | } | ||||||||||
| 205 | |||||||||||
| 206 | |||||||||||
| 207 | 19 | 1; | |||||||||
| 208 | |||||||||||
| 209 | __END__ | ||||||||||