#!/usr/bin/perl
# The Daily Travels of a PerlMonk
# a few definitions before we continue ...
our @worthy_nodes = ( 'informative', 'insightful', 'interesting', 'hum
+ourous' );
our @unworthy_nodes = ( 'plagarism', 'demeaning', 'rude', 'insulting'
+);
# our votes are a function of the voting and experience system
our $votes = {
'initiate' => 0,
'novice' => 5,
'acolyte' => 8,
'scribe' => 12,
'monk' => 16,
'friar' => 20,
'abbot' => 25,
'bishop' => 30,
'pontiff' => 35,
'saint' => 40,
# 'vroom' => ??? How do you define an infinite? undef?
};
# my level is a function of my xp, my votes are in turn derived from
+ my level
my $level = &{ $xp };
my $votes = $votes{ $level };
# while not working ... yeah, right - should this be while (1) ?
PM:
while (!$work) {
# iterate through our newest nodes, from the newest to the last
+checked node
our $newest_nodes;
foreach $node ( $newest_node .. $last_checked_node ) {
# should this be $content = &read( $node ) && eval $content
+?
&read( $node );
# if I have votes remaining ...
if ($votes) {
if ( eval {
# evaluate if the node contains elements of @worthy_
+nodes
grep { $node =~ /$_/ } @worthy_nodes
}) {
--$votes && $node++; # vote up the node
my $xp += &{ $chance }; # xp changes as a functi
+on of chance
} elsif ( eval {
# evaluate if the node contains elements of @unworth
+y_nodes
grep { $node =~ /$_/ } @unworthy_nodes
}) {
--$votes && $node--; # vote down the node
my $xp += &{ $chance }; # xp changes as a functi
+on of chance
} else {
next # move onto the next node
}
} else {
next # move onto the next node
}
}
} continue {
goto PM;
}
exit; # should never be reached ... if it is, something drastic ha
+s gone wrong!