| 1 | package Weaving::Tablet; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use Weaving::Tablet::Card; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | our $VERSION = '0.009.007'; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | has 'pattern_length' => (isa => 'Int', is => 'ro', default => 10); | |||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | has 'number_of_holes' => (isa => 'Int', is => 'ro', default => 4, writer => '_set_number_of_holes'); | |||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | has 'number_of_cards' => (isa => 'Int', is => 'rw', default => 20); | |||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | has 'cards' => (isa => 'ArrayRef[Weaving::Tablet::Card]', is => 'ro', default => sub { [] }); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | has 'color_table' => (isa => 'ArrayRef[Str]', is => 'ro', default => sub { [qw/red green blue black yellow white/] }); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | has 'file_name' => (isa => 'Str', is => 'rw'); | |||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | has 'dirty' => (isa => 'Bool', is => 'rw', default => 0); | |||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | has 'is_twill' => ( isa => 'Bool', is => 'rw', default => 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | sub BUILD | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=3 SCAR=12.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | if (defined $self->file_name) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | { | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | $self->load_pattern; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 40 | push @{$self->cards}, Weaving::Tablet::Card->new(number_of_turns => | |||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | $self->pattern_length) for 1..$self->number_of_cards; | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | sub load_pattern | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_pattern: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | return 0 unless defined $self->file_name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | return 0 unless -r $self->file_name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | open my $pattern, '<', $self->file_name or croak "Can't open ".$self->file_name.": $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my ($cards, $rows, $holes) = (split(/ /,<$pattern>))[0,2,4]; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | $holes ||= 4; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$holes ||= 4
MC/DC0%0/1
$holes ||= 4
$holes
Truth table0%0/2
A
A= $holes
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $self->number_of_cards($cards); | |||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | $self->_set_number_of_holes($holes); | |||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | # prime cards with empty cards | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | push @{$self->cards}, Weaving::Tablet::Card->new(number_of_turns => 0) for 1..$self->number_of_cards; | |||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $card; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | while (<$pattern>) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | { | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | last unless /^[\\\/|]/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | $self->insert_pick([-1, $_]); | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | # now $_ contains the start line... | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | tr /ABCDEFGH/01234567/; | |||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | my @starts = split(//, $_); | |||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | for my $card (0 .. $self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 59 | { | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | $self->cards->[$card]->start($starts[$card]); | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | $_ = <$pattern>; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my @SZ = split(//, $_); | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | for my $card (0 .. $self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 67 | { | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $self->cards->[$card]->SZ($SZ[$card]); | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | for my $card (0 .. $self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 72 | { | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | $_ = <$pattern>; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | $self->cards->[$card]->set_threading([split(/,/, $_)]); | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | pop @{$self->color_table} while @{$self->color_table}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | while (<$pattern>) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | { | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | push @{$self->color_table}, $_;# use X color names here | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | close $pattern; | |||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $self->color_pattern; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $self->twist_pattern; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $self->dirty(0); | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | sub reload_pattern | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reload_pattern: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $self->delete_card(0 .. $self->number_of_cards-1); | |||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $self->load_pattern; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | sub save_pattern | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
save_pattern: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my $file = $self->{file_name}; | |||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | return 0 unless $file || -w $file || -w '.'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$file or -w $file or -w "."
$file or -w $file
MC/DC0%0/3
$file or -w $file or -w "."
$file
-w $file
-w "."
Truth table0%0/4
A or B or C
A= $fileB= -w $fileC= -w "."
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $self->color_pattern; | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | open my $pattern, ">", $file or return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | print $pattern $self->dump_pattern; | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | close $pattern; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $self->dirty(0); | |||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | sub dump_pattern | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump_pattern: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my ($row, $card); | |||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my $pattern; | |||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $pattern = join(" ",$self->number_of_cards, 'cards', $self->number_of_rows, 'rows', $self->number_of_holes, 'holes')."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | for my $row (reverse 0 .. $self->number_of_rows-1) | |||||||||||||||||||||||||||||||||||||||||
| 129 | { | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $pattern .= join('', $self->row_turns($row), "\n"); | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | (my $start = join("",@{$self->start})) =~ tr/01234567/ABCDEFGH/; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $pattern .= $start."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $pattern .= join("",@{$self->SZ})."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | for my $card (0 .. $self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 139 | { | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | $pattern .= join(",",@{$self->threading($card)})."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | foreach (@{$self->color_table}) | |||||||||||||||||||||||||||||||||||||||||
| 144 | { | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $pattern .= $_."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $pattern; | |||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | sub color_pattern | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
color_pattern: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | my @cardlist = @_ == 0 ? (0 .. $self->number_of_cards-1) : @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | for my $card (@cardlist) | |||||||||||||||||||||||||||||||||||||||||
| 155 | { | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $self->cards->[$card]->color_card; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | sub twist_pattern | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
twist_pattern: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | ▶ | my @cardlist = @_ == 0 ? (0 .. $self->number_of_cards-1) : @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 1 | for my $card (@cardlist) | |||||||||||||||||||||||||||||||||||||||||
| 165 | { | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 20 | $self->cards->[$card]->twist_card; | |||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | sub float_pattern | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
float_pattern: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | my @cardlist = @_ == 0 ? (0 .. $self->number_of_cards-1) : @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | for my $card (@cardlist) | |||||||||||||||||||||||||||||||||||||||||
| 175 | { | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $self->cards->[$card]->float_card; | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | sub print_twist | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_twist: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my ($self, @rowlist) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $self->twist_pattern; | |||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | @rowlist = ($self->number_of_rows-1) unless @rowlist; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if (wantarray) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | { | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my @twist; | |||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | foreach my $row (@rowlist) | |||||||||||||||||||||||||||||||||||||||||
| 193 | { | ||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | push @twist, [$self->row_twist($row)]; | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | return @twist; | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | else | ||||||||||||||||||||||||||||||||||||||||||
| 199 | { | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $s; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | foreach my $row (@rowlist) | |||||||||||||||||||||||||||||||||||||||||
| 202 | { | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $rp = $row+1; | |||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $s .= "twist for row $rp: "; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $s .= join(",", $self->row_twist($row)); | |||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $s .= "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | return $s; | |||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | sub insert_pick | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_pick: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 2 | ▶ | push @_, [$self->number_of_rows-1, '/'x$self->number_of_cards] if @_ == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 2 | ▶ | while (@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | { | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 2 | my $rowspec = shift; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | my ($after, $turns) = @$rowspec; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 2 | $turns = pack('A'.$self->number_of_cards, $turns.'/' x $self->number_of_cards); | |||||||||||||||||||||||||||||||||||||||||
| 221 | 2 | my @turns = split(//, $turns); | |||||||||||||||||||||||||||||||||||||||||
| 222 | 2 | for my $card (0 .. $self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 223 | { | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 40 | $self->cards->[$card]->insert_picks($after, $turns[$card]); | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 2 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | sub insert_card | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_card: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | while (@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | { | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $rowspec = shift; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my ($after, $turns) = @$rowspec; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $turns = pack('A'.$self->{number_of_rows}, $turns.'/' x $self->{number_of_rows}); | |||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $card = Weaving::Tablet::Card->new(turns => $turns); | |||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | splice @{$self->cards}, $after+1, 0, $card; | |||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | sub delete_row | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_row: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my @rows = reverse sort { $a <=> $b } @_; | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | foreach my $card (0..$self->{number_of_cards}-1) | |||||||||||||||||||||||||||||||||||||||||
| 249 | { | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | $self->cards->[$card]->delete_picks(@rows); | |||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | sub delete_card | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_card: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | foreach my $card (reverse sort @_) | |||||||||||||||||||||||||||||||||||||||||
| 259 | { | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $self->{number_of_cards}--; | |||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | splice @{$self->cards}, $card, 1; | |||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | sub duplicate_row | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
duplicate_row: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | DUP: while (1) | |||||||||||||||||||||||||||||||||||||||||
| 271 | { | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | my $from = shift; return unless defined $from; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | my $to = shift; $to = $self->{number_of_rows}-1 unless defined $to; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | $self->{number_of_rows}++; | |||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | foreach my $card (0..$self->{number_of_cards}-1) | |||||||||||||||||||||||||||||||||||||||||
| 278 | { | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | splice @{$self->{turns}[$card]}, $to, 0, $self->{turns}[$card][$from]; | |||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | last DUP unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | sub duplicate_card | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
duplicate_card: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | DUP: while (1) | |||||||||||||||||||||||||||||||||||||||||
| 291 | { | ||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | my $from = shift; return unless defined $from; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | my $to = shift; $to = $self->{number_of_cards}-1 unless defined $to; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $self->{number_of_cards}++; | |||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | splice @{$self->{turns}}, $to, 0, [@{$self->{turns}[$from]}]; | |||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | splice @{$self->{SZ}}, $to, 0, $self->{SZ}[$from]; | |||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | splice @{$self->{start}}, $to, 0, $self->{start}[$from]; | |||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | splice @{$self->{threading}}, $to, 0, [@{$self->{threading}[$from]}]; | |||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | last DUP unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | sub number_of_rows | ||||||||||||||||||||||||||||||||||||||||||
| 308 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
number_of_rows: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 2 | shift->cards->[0]->{number_of_turns}; | |||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | sub SZ | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SZ: called CC=16 SCAR=48.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | my $card = shift; | |||||||||||||||||||||||||||||||||||||||||
| 316 | 1 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | 1 | ▶ | if (defined $value) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | { | ||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | warn "attempt to use $value as SZ setting for card $card" unless $value =~ /[SZ]/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | return unless $value =~ /[SZ]/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $self->cards->[$card]->SZ($value); | |||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | ▶ | elsif (defined($card) and ref($card) eq 'ARRAY') | |||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
defined $card and ref $card eq "ARRAY"
MC/DC0%0/2
defined $card and ref $card eq "ARRAY"
defined $card
ref $card eq "ARRAY"
Truth table33%1/3
A and B
A= defined $cardB= ref $card eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | { | ||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | if (grep !/^[SZ]$/, @$card) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | { | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | warn "attempt to use invalid SZ value for card $card"; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | croak; | |||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | my @values = @$card; | |||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | pop @values while @values > $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | splice @{$self->{SZ}}, 0, @values, @values; | |||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | ▶ | elsif (defined($card) and not ref($card)) | |||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
defined $card and not ref $card
MC/DC0%0/2
defined $card and not ref $card
defined $card
not ref $card
Truth table33%1/3
A and not(B)
A= defined $cardB= not ref $card
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | { | ||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | return $self->cards->[$card]->SZ; | |||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||
| 348 | elsif (not defined $card) | ||||||||||||||||||||||||||||||||||||||||||
| 349 | { | ||||||||||||||||||||||||||||||||||||||||||
| 350 | 1 | my @SZ; | |||||||||||||||||||||||||||||||||||||||||
| 351 | 1 | for my $card (0 .. $self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 352 | { | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 20 | push @SZ, $self->cards->[$card]->SZ; | |||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | 1 | return \@SZ; | |||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 357 | else | ||||||||||||||||||||||||||||||||||||||||||
| 358 | { | ||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | sub start | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my $card = shift; | |||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | if (defined $value) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | { | ||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | warn "attempt to use $value as start setting for card $card" unless $value =~ /[01234567]/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | return unless $value =~ /[01234567]/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $self->cards->[$card]->start($value); | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | ▶ | elsif (defined($card) and ref($card) eq 'ARRAY') | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $card and ref $card eq "ARRAY"
MC/DC0%0/2
defined $card and ref $card eq "ARRAY"
defined $card
ref $card eq "ARRAY"
Truth table0%0/3
A and B
A= defined $cardB= ref $card eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | { | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | if (grep !/^[01234567]$/, @$card) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | { | ||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | warn "attempt to use invalid start value for card $card"; | |||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | for my $c (0 .. $self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 387 | { | ||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | $self->start($c, $card->[$c]); | |||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | ▶ | elsif (defined($card) and not ref($card)) | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $card and not ref $card
MC/DC0%0/2
defined $card and not ref $card
defined $card
not ref $card
Truth table0%0/3
A and not(B)
A= defined $cardB= not ref $card
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | { | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | return $self->cards->[$card]->start; | |||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 399 | elsif (not defined $card) | ||||||||||||||||||||||||||||||||||||||||||
| 400 | { | ||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | my @start; | |||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | for my $card (0 .. $self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 403 | { | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | push @start, $self->cards->[$card]->start; | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | return \@start; | |||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||
| 408 | else | ||||||||||||||||||||||||||||||||||||||||||
| 409 | { | ||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | sub threading | ||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
threading: not called CC=21 SCAR=61.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | my ($card, $hole, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | if (@_ == 0) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | { | ||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | return [map { $self->cards->[$_]->threading } (0 .. $self->number_of_cards)]; | |||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 423 | elsif (@_ == 1) | ||||||||||||||||||||||||||||||||||||||||||
| 424 | { | ||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | return $self->cards->[$card]->threading; | |||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||
| 429 | elsif (@_ == 2) # (card, hole) or (card, listref_of_color_indices) | ||||||||||||||||||||||||||||||||||||||||||
| 430 | { | ||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | unless (ref($hole)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | { | ||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | return if $hole < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | ▶ | return if $hole >= $self->number_of_holes; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | return ($self->cards->[$card]->threading->[$hole]); | |||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | elsif (ref($hole) eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||||
| 440 | { | ||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | return if grep /\D/, @$hole; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | return if @$hole != $self->number_of_holes; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $self->card->[$card]->set_threading($hole); | |||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||
| 448 | else | ||||||||||||||||||||||||||||||||||||||||||
| 449 | { | ||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||
| 453 | elsif (@_ >= 3) | ||||||||||||||||||||||||||||||||||||||||||
| 454 | { | ||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | return if $hole < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | return if $hole >= $self->number_of_holes; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | $self->cards->[$card]->threading->[$hole] = $value; | |||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | sub turns | ||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
turns: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | my ($card, $row, $turn) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ▶ | if (@_ >= 3) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 470 | { | ||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | return if $row < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | ▶ | return if $row >= $self->number_of_rows; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | return unless $turn =~ /^[\\\/|]$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $self->card_turns($card)->[$row] = $turn; | |||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | elsif (@_ == 2) | ||||||||||||||||||||||||||||||||||||||||||
| 480 | { | ||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | return if $row < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | return if $row >= $self->number_of_rows; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | return $self->card_turns($card)->[$row]; | |||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||
| 487 | else | ||||||||||||||||||||||||||||||||||||||||||
| 488 | { | ||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | return (@{$self->{turns}}); | |||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | sub row_turns | ||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
row_turns: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my ($row, $turns) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ▶ | if (@_ >= 2) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 499 | { | ||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | ▶ | return if $row < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | return if $row >= $self->number_of_rows; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | foreach my $c (0..$self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 503 | { | ||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | last if $c >= @$turns; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | $self->card_turns($c)->[$row] = $$turns[$c]; | |||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | elsif (@_ == 1) | ||||||||||||||||||||||||||||||||||||||||||
| 510 | { | ||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | ▶ | return if $row < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | return if $row >= $self->number_of_rows; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | my @row; | |||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | foreach my $c (0..$self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 515 | { | ||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | push @row, $self->card_turns($c)->[$row]; | |||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | return @row; | |||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||
| 520 | else | ||||||||||||||||||||||||||||||||||||||||||
| 521 | { | ||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | sub card_turns | ||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
card_turns: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | my ($card, $turns) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | ▶ | if (@_ >= 2) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 532 | { | ||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my @values = @$turns; | |||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | pop @values while @values > $self->number_of_rows; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | $self->dirty(1); | |||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | splice @{$self->cards->[$card]->turns}, 0, @values, @values; | |||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||
| 540 | elsif (@_ == 1) | ||||||||||||||||||||||||||||||||||||||||||
| 541 | { | ||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | return if $card < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | return if $card >= $self->number_of_cards; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | return $self->cards->[$card]->turns; | |||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||
| 546 | else | ||||||||||||||||||||||||||||||||||||||||||
| 547 | { | ||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | sub twist | ||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
twist: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | my ($card, $row) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | return @{$self->{twist}} unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | return unless ($card >= 0 and $card < $self->number_of_cards); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$card >= 0 and $card < $self->number_of_cards
MC/DC0%0/2
$card >= 0 and $card < $self->number_of_cards
$card >= 0
$card < $self->number_of_cards
Truth table0%0/3
A and B
A= $card >= 0B= $card < $self->number_of_cards
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | ▶ | return unless ($row >= 0 and $row < $self->number_of_rows); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$row >= 0 and $row < $self->number_of_rows
MC/DC0%0/2
$row >= 0 and $row < $self->number_of_rows
$row >= 0
$row < $self->number_of_rows
Truth table0%0/3
A and B
A= $row >= 0B= $row < $self->number_of_rows
| |||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | return $self->card_twist->[$row]; | |||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | sub row_twist | ||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
row_twist: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | my $row = shift; | |||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | ▶ | return unless defined $row; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | ▶ | return unless ($row >= 0 and $row < $self->number_of_rows); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$row >= 0 and $row < $self->number_of_rows
MC/DC0%0/2
$row >= 0 and $row < $self->number_of_rows
$row >= 0
$row < $self->number_of_rows
Truth table0%0/3
A and B
A= $row >= 0B= $row < $self->number_of_rows
| |||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | my @row; | |||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | foreach my $c (0 .. $self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 572 | { | ||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | push @row, $self->card_twist($c)->[$row]; | |||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | return @row; | |||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | sub card_twist | ||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
card_twist: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | my $card = shift; | |||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | ▶ | return unless defined $card; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | ▶ | return unless ($card >= 0 and $card < $self->number_of_cards); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$card >= 0 and $card < $self->number_of_cards
MC/DC0%0/2
$card >= 0 and $card < $self->number_of_cards
$card >= 0
$card < $self->number_of_cards
Truth table0%0/3
A and B
A= $card >= 0B= $card < $self->number_of_cards
| |||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | return $self->cards->[$card]->twist; | |||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | sub color | ||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
color: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | my ($card, $row) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | ▶ | return @{$self->{color}} unless @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | ▶ | return unless ($card >= 0 and $card < $self->number_of_cards); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$card >= 0 and $card < $self->number_of_cards
MC/DC0%0/2
$card >= 0 and $card < $self->number_of_cards
$card >= 0
$card < $self->number_of_cards
Truth table0%0/3
A and B
A= $card >= 0B= $card < $self->number_of_cards
| |||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | return unless ($row >= 0 and $row < $self->number_of_rows); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$row >= 0 and $row < $self->number_of_rows
MC/DC0%0/2
$row >= 0 and $row < $self->number_of_rows
$row >= 0
$row < $self->number_of_rows
Truth table0%0/3
A and B
A= $row >= 0B= $row < $self->number_of_rows
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | return $self->card_color($card)->[$row]; | |||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||
| 599 | sub row_color | ||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
row_color: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | my $row = shift; | |||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | ▶ | return unless defined $row; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | return unless ($row >= 0 and $row < $self->number_of_rows); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$row >= 0 and $row < $self->number_of_rows
MC/DC0%0/2
$row >= 0 and $row < $self->number_of_rows
$row >= 0
$row < $self->number_of_rows
Truth table0%0/3
A and B
A= $row >= 0B= $row < $self->number_of_rows
| |||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | my @row; | |||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | foreach my $c (0..$self->number_of_cards-1) | |||||||||||||||||||||||||||||||||||||||||
| 608 | { | ||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | push @row, $self->card_color($c)->[$row]; | |||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | return @row; | |||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||
| 614 | sub card_color | ||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
card_color: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | my $card = shift; | |||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | return unless defined $card; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | ▶ | return unless ($card >= 0 and $card < $self->number_of_cards); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$card >= 0 and $card < $self->number_of_cards
MC/DC0%0/2
$card >= 0 and $card < $self->number_of_cards
$card >= 0
$card < $self->number_of_cards
Truth table0%0/3
A and B
A= $card >= 0B= $card < $self->number_of_cards
| |||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | return $self->cards->[$card]->color; | |||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | 3 | 1; # Magic true value required at end of module | |||||||||||||||||||||||||||||||||||||||||
| 626 | __END__ | ||||||||||||||||||||||||||||||||||||||||||