NAME

Games::Bingo::Column

SYNOPSIS

my $c = Games::Bingo::Column->new();

foreach my $number(@numbers) { $c->populate($number); }

my @numbers = qw(1 2 3 4 5 6 7 8 9); my $c = Games::Bingo::Column->new(@numbers);

my $number = $c->get_number(1); my $c->set_status(1);

DESCRIPTION

The Column is used when building the bingo plates and is a temporary data structure.

The class has two attributes:

  • _array

    Array is a list of numbers for containment in the class, since the class actually is nothing but an array with a status flag.

  • _status

    The status attribute is a flag indicating whether the collection has been used during the generation of bingo plates, please refer to the accessor set_status for more information.

METHODS

new ($;@)

The contructor optionally takes an array as an argument, and sets the _array attribute to point to this.

populate ($$)

populate is a simple accessor which can be used to add additional number to the list of number contained in the class. This is a secondary use of the class, please refer to the description of the algoritms used in the program described in the Games::Bingo class.

set_status ($$)

This accessor method can be used to set the status of the Column, the attribute _status. The values used to indicate whether the column has been used is 1 for true and 0 for false. Meaning 0 is the default value and the value of a new Column.

get_number ($;$)

The get_number is also a simple accessor, it return a random number from the list contained in the class.

If the optional parameter is set to true, it splices the list contained in the class, meaning the class shrinks by 1. Default behaviour is not shrinking.

_reverse

The method used by Perls sort to sort the list

SEE ALSO

Games::Bingo
Games::Bingo::ColumnCollection

TODO

The TODO file contains a complete list for the whole Games::Bingo project.

AUTHOR

jonasbn <jonasbn@io.dk>

ACKNOWLEDGEMENTS

My friend Allan helped me out with some of the algoritmic stuff and was in on the development when this class was thought up.

COPYRIGHT

Games::Bingo and related modules are free software and is released under the Artistic License. See <http://www.perl.com/language/misc/Artistic.html> for details.

Games::Bingo is (C) 2003 Jonas B. Nielsen (jonasbn) <jonasbn@io.dk>