#!/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!
perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|