Dreamhack-Solitaire-Medici
view release on metacpan or search on metacpan
lib/Dreamhack/Solitaire/Medici.pm view on Meta::CPAN
no warnings 'recursion';
use base 'Dreamhack::Solitaire';
use Dreamhack::Solitaire;
our $VERSION = "0.01";
sub process {
my ($self, %args) = @_;
my $imax = (exists $args{'attempts'}) && ($args{'attempts'} =~ m/^[1-9]\d*$/) ? $args{'attempts'} : $self->_iterations(1+$#{$self->{'leftcards'}});
for my $i (1..$imax) {
my @layout = $self->add_rnd_layout();
my @save = @layout;
my @work = ();
my $cardno = 0;
while (@layout) {
my $el = shift @layout;
lib/Dreamhack/Solitaire/Medici.pm view on Meta::CPAN
else {
@work = $self->_pass(--$offset, \@work);
}
}
else {
return @work
}
return @work
}
sub _iterations {
my ($self, $cardscount) = @_;
my $imax = 0;
if ($cardscount <= 1) {
$imax = 1;
}
else {
$imax = 100_000;
}
return $imax
( run in 0.428 second using v1.01-cache-2.11-cpan-5511b514fd6 )