NAME

Games::Sudoku::Component::Controller::Status

SYNOPSIS

use Games::Sudoku::Component::Controller;

my $c = Games::Sudoku::Component::Controller->new;
until($c->status->is_finished) {
  $c->next;
}

DESCRIPTION

This module is to hold a status of Games::Sudoku::Component::Controller.

METHODS

new

Creates an object. Options are:

rewind_max (integer)
retry_max (integer)

Specifies how many times the controller can rewind/retry. See Games::Sudoku::Component::Controller.

is_null

Returns true if the controller has no special status.

is_ok

Returns true if the controller has some cells to do with next.

is_rewind

Returns true if the controller has failed to solve a puzzle and is rewinding.

is_solved

Returns true if the controller has solved a puzzle.

is_giveup

Returns true if the controller has finally given up to solve a puzzle.

is_finished

Returns true if the controller has solved a puzzle or given up to solve.

is_changed

Returns true if the status has just changed. Once checked, this flag will be turn off.

turn_to_ok

turn_to_rewind

turn_to_solved

turn_to_giveup

Changes the status to something, respectively.

can_rewind

Returns true if the controller is still able to rewind. If the internal counter grows larger than rewind_max, this returns false.

can_retry

Returns true if the controller is still able to retry. If the internal counter grows larger than retry_max, this returns false.

clear

Clears the status.

SEE ALSO

Games::Sudoku::Component,
Games::Sudoku::Component::Controller

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.