Games::Sudoku::Component::Table::Cell
my $table = Games::Sudoku::Component::Table->new; foreach my $cell ($table->cells) { # Now $cell is a Games::Sudoku::Component::Table::Cell object. my $item = Games::Sudoku::Component::Table::Item->new( row => $cell->row, col => $cell->col, allowed => [ $cell->allowed ], ); ... } # Also, $table->cell(row, col) returns a ::Cell object. $table->cell(5,5)->value(3);
This module is for a cell of a puzzle board (table). There are several methods here, but some of them are mainly used internally. What you'll actually use are: value, allowed, is_locked, and maybe, row and col.
Creates an object. Below options are mandatory:
Row/column id of the cell, respectively.
perm
Games::Sudoku::Component::Table::Permission object.
See also the base class Games::Sudoku::Component::Base. Actually size related options are required, too.
Returns a row/column id of the cell respectively, just for convenience.
As a getter, this returns a surface value of the cell, that is, if the cell has a temporary (denied) value, returns it; otherwise, returns a real (allowed) value.
As a setter, you can set (or reset) a value of the cell, regardless of its permission. If the value is not allowed, the value is held as a temporary one. However, it is totally ignored if the cell is locked.
Returns a real value of the cell. If the cell has a temporary value, returns 0.
Returns a temporary value of the cell. If the cell has a real value, returns 0.
Returns an array of allowed values for the cell.
Returns true if the argument value is allowed for the cell.
Locks the cell to keep the original puzzle untainted. The locked cell will ignore any new values until it is unlocked.
Unlocks the cell to make it accept new values.
Returns true if the cell is locked.
Kenichi Ishigaki, <ishigaki@cpan.org>
Copyright (C) 2006 by Kenichi Ishigaki
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Games::Sudoku::Component, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Sudoku::Component
CPAN shell
perl -MCPAN -e shell install Games::Sudoku::Component
For more information on module installation, please visit the detailed CPAN module installation guide.