Games-Sudoku-General
view release on metacpan or search on metacpan
Use manifest constants for reference types.
Update metadata.
0.018 2016-03-01 T. R. Wyant
Deprecate 3rd value in set( brick => ... );
This has been documented as deprecated for some time. This update
documents a deprecation schedule, and includes machinery to display
deprecation warnings.
Move clipboard functionality to module Clipboard. This module is
optional; without it copy() and paste() throw exceptions.
Add Makefile targets authortest, testcover.
0.017 2016-01-05 T. R. Wyant
Add GitHub repository to metadata.
0.016 2015-11-11 T. R. Wyant
Remove {Build,Makefile}.PL question about sudokug installation. Also
remove OS-specific code to build the executable if it is in fact
to David Jelinek of Central Michigan University
for diagnosing the problem and finding a
solution.
Corrected spelling.
Eliminated Scalar::Util::looks_like_number, since
apparently ActivePerl does not have it.
Add copy() method and autocopy attribute, for getting
generated puzzles onto the clipboard.
Add paste() method, for loading puzzles from the
clipboard.
Add unload() method.
In bin/sudokug, allowed input to be redirected or piped in, and added
-filter option.
0.005 2005-12-20 T. R. Wyant
Added generate() method and generation_limit
attribute.
inc/My/Module/Recommend.pm view on Meta::CPAN
package My::Module::Recommend;
use strict;
use warnings;
use Carp;
use My::Module::Recommend::Any qw{ __any };
my @optionals = (
__any( 'Clipboard' => <<'EOD' ),
This module is needed to exchange data with the system clipboard.
If you do not intend to use the copy() or paste() methods, you do
not need to install this module.
EOD
);
sub optionals {
return ( map { $_->modules() } @optionals );
}
sub recommend {
inc/mock/Clipboard.pm view on Meta::CPAN
use Carp;
our $VERSION = '0.028';
sub import {
return;
}
{
my $clipboard;
sub copy {
my ( undef, $content ) = @_;
$clipboard = $content;
return;
}
sub paste {
return $clipboard;
}
}
1;
__END__
=head1 NAME
Clipboard - Mock the Clipboard module
inc/mock/Clipboard.pm view on Meta::CPAN
Clipboard->copy( 'Able was I ere I saw Elba.' );
This static method saves its argument, making it available to the
L<paste()|/paste> method.
=head2 import
This method does nothing. It needs to be present because the real
L<Clipboard|Clipboard> module uses it as a hook to determine which
clipboard interface to use.
=head2 paste
say Clipboard->paste();
This method returns the data from the most-recent call to
L<copy()|/copy>. If C<copy()> has never been called, the return is
undefined.
=head1 SEE ALSO
lib/Games/Sudoku/General.pm view on Meta::CPAN
across a symbol set change.
Because symbol set names must be parsed like symbol names when a
problem is defined, they also affect the need for whitespace on
problem input. See the L<problem()|/problem> documentation for
full details.
=item autocopy (boolean)
If true, this attribute causes the generate() method to implicitly call
copy() to copy the generated problem to the clipboard.
This attribute is false by default.
=item brick (string, write-only)
This "virtual" attribute is a convenience, which causes the object to be
configured with a topology of rows, columns, and rectangles. The value
set must be either a comma-separated list of two numbers (e.g. '3,2')
or a reference to a list containing two numbers (e.g. [3, 2]). Either
way, the numbers represent the horizontal dimension of the rectangle (in
lib/Games/Sudoku/General.pm view on Meta::CPAN
return %{$self->{constraints_used}} if wantarray;
my $rslt = join ' ', grep {
$self->{constraints_used}{$_}} qw{F N B T X Y W ?};
return $rslt;
}
=head2 copy
$su->copy ()
This method copies the current problem to the clipboard. If solution()
has been called, the current solution goes on the clipboard.
See L<CLIPBOARD SUPPORT|/CLIPBOARD SUPPORT> for what is needed for this
to work.
=cut
{ # Local symbol block.
my $copier;
sub copy {
my ( $self ) = @_;
lib/Games/Sudoku/General.pm view on Meta::CPAN
$rslt .= "\n";
return $rslt;
}
sub _get_value {return $_[0]->{$_[1]}}
=head2 paste
$su->paste()
This method pastes a problem from the clipboard.
See L<CLIPBOARD SUPPORT|/CLIPBOARD SUPPORT> for what is needed for this
to work.
=cut
{ # Begin local symbol block
my $paster;
sub paste {
script/sudokug view on Meta::CPAN
sudokug> constraints_used
This command lists the constraints used to provide the most recent
solution.
=head3 copy
sudokug> copy
Copy the current puzzle or solution to the clipboard. See the CLIPBOARD
SUPPORT section of the L<Games::Sudoku::General> documentation for what
you need to make this work.
=head3 drop_set
sudokug> drop_set main_diagonal
This command drops a set from the existing topology. The argument is the
name of the new set.
script/sudokug view on Meta::CPAN
This command instantiates a Games::Sudoku::General object. You get one
for free when you launch this script; this command is for those cases
when it is easier to start over with a new object than to reconfigure
the one you already have. Any arguments get passed to the set() method.
=head3 paste
sudokug> paste
Paste a new puzzle from the clipboard. See the CLIPBOARD SUPPORT
section of the L<Games::Sudoku::General> documentation for what you
need to make this work.
=head3 problem
sudokug> problem <<EOD
EOD: . . . 4 . . 7 8 9
EOD: 4 . 6 . . . 1 . .
EOD: . 8 . . . . . 5 .
EOD: 2 . 4 . . 5 . . .
script/sudokug view on Meta::CPAN
=over
=item allowed_symbols (string)
This attribute is used to specify and name sets of allowed symbols. See
above for an example.
=item autocopy (boolean)
If true (in the Perl sense) generated problems are copied to the
clipboard.
=item brick (string, write-only)
This pseudo-attribute sets the topology, symbols, and columns for a
Sudoku puzzle involving rectangular regions rather than square ones.
The value is a comma-delimited string of three numbers representing
the horizontal and vertical dimensions of the rectangular regions, and
the size of the enclosing square.
The last number may be omitted, with the default being the product of
. 8 . . . . . 5 .
2 . 4 . . 5 . . .
. 9 5 . . . . . .
. . . 9 . 2 3 4 5
. 3 . . 7 . 9 . 8
. 6 7 . . 1 . . .
9 . . . . 8 . . 2
EOD
$su->copy();
is( Clipboard->paste(), <<'EOD', 'Copy to clipboard' );
. . . 4 . . 7 8 9
4 . 6 . . . 1 . .
. 8 . . . . . 5 .
2 . 4 . . 5 . . .
. 9 5 . . . . . .
. . . 9 . 2 3 4 5
. 3 . . 7 . 9 . 8
. 6 7 . . 1 . . .
9 . . . . 8 . . 2
EOD
( run in 0.923 second using v1.01-cache-2.11-cpan-2398b32b56e )