NAME

Games::Sudoku::Component::Table::Item

SYNOPSIS

use Games::Sudoku::Component::Table::Item;

my $item = Games::Sudoku::Component::Table::Item->new(
  row     => 2,
  col     => 3,
  allowed => [2, 3, 4],
);

my $next_candidate = $item->random_value;

DESCRIPTION

This module is mainly used to bridge between ::Controller::History object and ::Table (and ::Table::Cell) object. Maybe you don't need to touch this explicitly.

METHODS

new (hash or hashref)

Creates an object. Below options are mandatory:

row (integer)
col (integer)

Row/column id of the item (cell), respectively.

allowed (arrayref)

Arrayref of allowed values for the item (cell).

Below is optional:

value

Initial value.

row

col

Returns a row/column id of the item (cell), respectively.

value

Returns a value of the item (cell).

allowed

Returns an array of allowed values of the item (cell).

random_value

Returns one of the allowed values of the item (cell). The value is pulled out of the array of allowed values.

as_string

Returns a dump string of the item (cell), maybe just for debugging.

SEE ALSO

Games::Sudoku::Component,
Games::Sudoku::Component::Table,
Games::Sudoku::Component::Table::Cell

AUTHOR

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE

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.