Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • 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 romping around the Monastery: (7)
    As of 2014-09-23 09:09 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (216 votes), past polls