Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

A trivial update for the new system:

#!/usr/bin/perl use warnings; use strict; use Lingua::EN::Inflect 'A'; my ($day, $level, $xp); $level = {xp => 0, votes => 0, title => "Initiate", next => {xp => 20, votes => 2, title => "Novice", next => {xp => 50, votes => 4, title => "Acolyte", next => {xp => 90, votes => 6, title => "Sexton", next => {xp => 150, votes => 8, title => "Beadle", next => {xp => 250, votes => 10, title => "Scribe", next => {xp => 400, votes => 12, title => "Monk", next => {xp => 600, votes => 14, title => "Pilgrim", next => {xp => 900, votes => 16, title => "Friar", next => {xp => 1300, votes => 18, title => "Hermit", next => {xp => 1800, votes => 20, title => "Chaplain", next => {xp => 2400, votes => 22, title => "Deacon", next => {xp => 3000, votes => 24, title => "Curate", next => {xp => 4000, votes => 26, title => "Priest", next => {xp => 5400, votes => 28, title => "Vicar", next => {xp => 7000, votes => 30, title => "Parson", next => {xp => 9000, votes => 32, title => "Prior", next => {xp => 12000, votes => 34, title => "Monsignor", next => {xp => 16000, votes => 36, title => "Abbot", next => {xp => 22000, votes => 38, title => "Canon", next => {xp => 30000, votes => 40, title => "Chancellor", next => {xp => 40000, votes => 42, title => "Bishop", next => {xp => 50000, votes => 44, title => "Archbishop", next => {xp => 60000, votes => 46, title => "Cardinal", next => {xp => 70000, votes => 48, title => "Sage", next => {xp => 80000, votes => 50, title => "Saint", next => {xp => 90000, votes => 52, title => "Apostle", next => {xp => 100000, votes => 54, title => "Pope"}}}}}}}}}}}}}}}}}} +}}}}}}}}}}; $| = 1; print "Enter your current xp: "; chomp($xp = <STDIN>); die "Doesn't look quite like an xp to me\n" if $xp ne do { no warnings 'numeric'; 0+$xp }; $day = 0; while ($level->{next}) { # bonus for casting all votes (through level 5) $xp += int($level->{votes}/6) if $day > 0 && $level->{votes} < 10; + ($level = $level->{next}) and print("Day $day: you are ", A($level->{title}), "\n") while $level->{next} && $xp >= $level->{next}{xp}; ++$day; # 25% chance for each vote cast (rand(4) < 1) and ++$xp for 1..$level->{votes}; # 25% chance for 2 xp for logging in (rand(4) < 1) and $xp += 2; }

Now repeat after me: "I am not an XP whore... I am not an XP whore..." ;-)

planetscape

In reply to Re: Sainthood via Seniority Simulation by planetscape
in thread Sainthood via Seniority Simulation by ysth

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2021-06-13 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (54 votes). Check out past polls.

    Notices?