Games::Dukedom - The classic big-iron game
use Games::Dukedom; my $game = Games::Dukedom->new();
This is an implementation of the classic game of "Dukedom". It is intended to be display agnostic so that it can be used not only by command line scripts such as the one included but also by graphical UIs such as Tk or web sites.
It has been implemented as an "interrupt driven" state-machine. The actual executable only needs to provide the callback hooks to display messages and collect appropriate input as requested.
One begins the game by calling the expected new method like so:
new
my $game = Games::Dukedom->new();
It currently does not take any parameters.
This method begins a new year of play. It initializes the temporary structures and factors and resets the state-machine.
Indicates that current game is over and further play is not possible. A "win" is indicated by a positive value, a "loss" by a negative one.
Returns a boolean indicating that the current contents of $self->input is either "Y" or "N" (case insensitive).
$self->input
Returns a boolean indicating that the current contents of $self->input is "0" or a positive integer.
This package is based on the logic found in this C code, which appears to have been derived from an older source written in Basic:
https://github.com/caryo/Dukedom/blob/master/imports/dukedom.c
Seriously? Look at the version number.
Jim Bacon, <jim@nortx.com>
Copyright (C) 2014 by Jim Bacon
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version or, at your option, any later version of Perl 5 you may have available.
To install Games::Dukedom, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Dukedom
CPAN shell
perl -MCPAN -e shell install Games::Dukedom
For more information on module installation, please visit the detailed CPAN module installation guide.