NAME
Games::Die - it's a die; you can roll it!
VERSION
version 0.99_01
$Id: Die.pm,v 1.5 2004/10/19 03:52:28 rjbs Exp $
SYNOPSIS
$six_sided = Games::Die->new(sides => 6);
$twenty_sided = Games::Die->new(20);
$twenty_sided->sides; # 20
$total = $six_sided->roll() + $twenty_sided->roll();
DESCRIPTION
Games::Die provides an object-oriented implementation of a polyhedral die that can be rolled.
METHODS
new(sides => $sides)
This method creates and returns a new Die. The number of sides must be an integer greater than zero. If you only need to pass sides
, you can omit the name, as follows:
my $d6 = Games::Die->new(6);
Other parameters will probably appear only in subclasses of Games::Die.
$die->sides()
This method returns the number of sides on this die.
$die->roll()
Rolls the die and returns the number that came up.
TODO
see Games::Dice
AUTHORS
Ricardo SIGNES <rjbs@cpan.org
>
LICENSE
Copyright (C) 2005, Ricardo SIGNES.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.