line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Games::Sudoku::Component;
|
2
|
|
|
|
|
|
|
{
|
3
|
2
|
|
|
2
|
|
52060
|
use strict;
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
473
|
|
4
|
2
|
|
|
2
|
|
28
|
use warnings;
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
86
|
|
5
|
2
|
|
|
2
|
|
81
|
use Carp;
|
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
380
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.02';
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1919
|
use Games::Sudoku::Component::Controller;
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
604
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new {
|
12
|
3
|
|
|
3
|
1
|
2584
|
my $class = shift;
|
13
|
3
|
|
33
|
|
|
26
|
my $this = bless {}, (ref $class || $class);
|
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
|
|
23
|
$this->{ctrl} = Games::Sudoku::Component::Controller->new(@_);
|
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
|
|
19
|
$this;
|
18
|
|
|
|
|
|
|
}
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub generate {
|
21
|
1
|
|
|
1
|
1
|
783
|
my $this = shift;
|
22
|
|
|
|
|
|
|
|
23
|
1
|
50
|
|
|
|
7
|
my %options = ref $_[0] ? %{ $_[0] } : @_;
|
|
0
|
|
|
|
|
0
|
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
7
|
my $size = $this->{ctrl}->table->size;
|
26
|
1
|
|
33
|
|
|
13
|
my $blanks = $options{blanks} || ($size ** 2) * 0.75;
|
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
6
|
$this->{ctrl}->solve;
|
29
|
1
|
|
|
|
|
8
|
$this->{ctrl}->make_blank($blanks);
|
30
|
|
|
|
|
|
|
}
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub load {
|
33
|
0
|
|
|
0
|
1
|
0
|
my $this = shift;
|
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
$this->{ctrl}->load(@_);
|
36
|
|
|
|
|
|
|
}
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub solve {
|
39
|
2
|
|
|
2
|
1
|
761
|
my $this = shift;
|
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
11
|
$this->{ctrl}->solve;
|
42
|
|
|
|
|
|
|
}
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub is_solved {
|
45
|
1
|
|
|
1
|
1
|
7
|
my $this = shift;
|
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
5
|
$this->{ctrl}->status->is_solved;
|
48
|
|
|
|
|
|
|
}
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub clear {
|
51
|
0
|
|
|
0
|
1
|
0
|
my $this = shift;
|
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
0
|
$this->{ctrl}->clear;
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub as_string {
|
57
|
1
|
|
|
1
|
1
|
61
|
my $this = shift;
|
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
111
|
$this->{ctrl}->table->as_string(@_);
|
60
|
|
|
|
|
|
|
}
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub as_HTML {
|
63
|
0
|
|
|
0
|
1
|
|
my $this = shift;
|
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$this->{ctrl}->table->as_HTML(@_);
|
66
|
|
|
|
|
|
|
}
|
67
|
|
|
|
|
|
|
}
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1;
|
70
|
|
|
|
|
|
|
__END__
|