NAME
Games::Bingo - a bingo game Perl implementation
SYNOPSIS
use Games::Bingo;
my $bingo = Games::Bingo->new(90);
my $number = $bingo->play();
my @taken;
$bingo->take(\@taken, $number);
or
use Games::Bingo;
my $bingo = Games::Bingo->new();
my @numbers;
$bingo->init(\@numbers, 90);
my $number = $bingo->play(\@numbers);
my @taken;
$bingo->take(\@taken, $number);
DESCRIPTION
This is a simple game of bingo. The program can randomly call out the numbers. The game will be get more features in the future, please refer to the TODO section (below).
METHODS
This are the central methods of Games::Bingo
new
The constructor is quite simple. It can either be called without any paramters and then followed by a call to init see below. Or the ceiling for the numbers (stored internally) can be given as a parameter, the latter is the recommeded use, please refer to the SYNOPSIS.
init
This method takes two parameters. An array reference and a ceiling, the method will push numbers onto the array reference from 1 to ceiling (including the ceiling). Initializing the numbers for the game.
The use of init is not recommended, use the constructor in the recommended way instead.
play
The play is one of the essential methods in the game, it takes an array reference and returns a random number from the array referenced to. The reference shrinks with one with each call.
The recommended way is though to use the internally stored array, where play then takes no arguments, please refer to new and init and the SYNOPSIS.
take
The take method is the memory of the game. It takes to parameters, a reference to an array of arrays (the memory), and additionaly the number picked by e.g. the play method.
Since the first program to use the class/module was a console based the take method organizes the numbers in an array of array for a nicer presentation. This will probably be changed later (if necessary).
random
The encapsulation of the rand function. Takes a number as a paramtere and returns a number between 0 and the number given as a parameter just as rand (% perldoc -f rand).
The result is rounded down using POSIX::floor
SEE ALSO
- Games::Bingo::Column
- Games::Bingo::ColumnCollection
- Games::Bingo::Print
- Games::Bingo::Print::Plate
- bin/bingo.pl
TODO
The TODO file contains a complete list for the whole Games::Bingo project.
AUTHOR
jonasbn >jonasbn@io.dk<
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<