line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Math::Tutor::Cmd::Power::Cmd::Rules; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3516
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use vars qw(@ISA $VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
66
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
App::Math::Tutor::Cmd::Natural::Cmd::Add - Plugin for addition and subtraction of natural numbers |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
17
|
1
|
|
|
1
|
|
245
|
use MooX::Cmd; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
18
|
1
|
|
|
1
|
|
1449
|
use MooX::Options; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has template_filename => ( |
21
|
|
|
|
|
|
|
is => "ro", |
22
|
|
|
|
|
|
|
default => "twocols" |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
with "App::Math::Tutor::Role::PowerExercise"; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _build_exercises |
28
|
|
|
|
|
|
|
{ |
29
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my (@tasks); |
32
|
0
|
|
|
|
|
|
foreach my $i ( 1 .. $self->quantity ) |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
|
|
|
my @line; |
35
|
0
|
|
|
|
|
|
foreach my $j ( 0 .. 1 ) |
36
|
|
|
|
|
|
|
{ |
37
|
0
|
|
|
|
|
|
my ($a) = $self->get_power_to(1); |
38
|
0
|
|
|
|
|
|
push @line, [$a]; |
39
|
|
|
|
|
|
|
} |
40
|
0
|
|
|
|
|
|
push @tasks, \@line; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my $exercises = { |
44
|
|
|
|
|
|
|
section => "Power mathematic rules", |
45
|
|
|
|
|
|
|
caption => 'Power mathematic rules', |
46
|
|
|
|
|
|
|
label => 'power_to', |
47
|
|
|
|
|
|
|
header => [ [ 'Simpify', 'Simplify' ] ], |
48
|
|
|
|
|
|
|
solutions => [], |
49
|
|
|
|
|
|
|
challenges => [], |
50
|
|
|
|
|
|
|
}; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
foreach my $line (@tasks) |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
|
|
|
my ( @solution, @challenge ); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
foreach my $i ( 0 .. 1 ) |
57
|
|
|
|
|
|
|
{ |
58
|
0
|
|
|
|
|
|
my ($a) = @{ $line->[$i] }; |
|
0
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
push @challenge, sprintf( '$ %s = $', $a ); |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my @way; # remember Frank Sinatra :) |
62
|
0
|
|
|
|
|
|
push @way, sprintf( "%s", $a ); |
63
|
0
|
|
|
|
|
|
$a->mode( ( $a->mode + 1 ) % 2 ); |
64
|
0
|
|
|
|
|
|
push @way, sprintf( "%s", $a ); |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
push( @solution, '$ ' . join( " = ", @way ) . ' $' ); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
push( @{ $exercises->{solutions} }, \@solution ); |
|
0
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
push( @{ $exercises->{challenges} }, \@challenge ); |
|
0
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
$exercises; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Copyright 2010-2014 Jens Rehsack. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
81
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
82
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |