NAME
Games::Dukedom - The classic big-iron game
SYNOPSIS
use Games::Dukedom;
my $game = Games::Dukedom->new();
DESCRIPTION
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.
CONSTRUCTOR
One begins the game by calling the expected new
method like so:
my $game = Games::Dukedom->new();
It currently does not take any parameters.
ACCESSORS
black_D
grain
input
king_unrest
land
land_fertility
population
status
unrest
war
year
yield
METHODS
play_one_year
This method begins a new year of play. It initializes the temporary structures and factors and resets the state-machine.
game_over
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.
- 2 - It's GOOD to be the King!
- 1 - You have retired
- -1 - You have been deposed
- -2 - Don't mess with the King!
- -3 - You have abandoned the game
input_is_yn
Returns a boolean indicating that the current contents of $self->input
is either "Y" or "N" (case insensitive).
input_is_value
Returns a boolean indicating that the current contents of $self->input
is "0" or a positive integer.
summary_report
fertility_report
end_of_year_report
SEE ALSO
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
BUGS
Seriously? Look at the version number.
AUTHOR
Jim Bacon, <jim@nortx.com>
COPYRIGHT AND LICENSE
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.