Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Next from inner loop only works "most of the time"

by tybalt89 (Monsignor)
on May 20, 2021 at 09:34 UTC ( [id://11132769]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Next from inner loop only works "most of the time"
in thread Next from inner loop only works "most of the time"

First guess:

$master_letter_list = lc $1; ## Force all letter lists to LOWE +R CASE only %master_letter_freq = (); # <--- ** MISSING LINE ** for (split //,$master_letter_list)

Every time $master_letter_list is changed, the frequency hash must be cleared before being added to.

The occasional "failure" is due to the differing sequences of user interaction.

Replies are listed 'Best First'.
Re^4: Next from inner loop only works "most of the time"
by Marshall (Canon) on May 20, 2021 at 11:16 UTC
    I appreciate your suggestion!

    This very well could be the "solution to the problem".
    And also explain why previous commands made a difference in the result.
    A state dependent failure where what happened before affects what happens now.

    My previous thinking of reproducing an entire session would have caused a "hard failure".
    The issue is "previous state" dependent.

    Thank you, Marshall

    if ($line =~ /^\s*:([a-zA-Z]+)\s*$/) # new list of letters { $master_letter_list = lc $1; ## Force all letter lists to LOWE +R CASE only %master_letter_freq=(); ########### ADDED ########## for (split //,$master_letter_list) { $master_letter_freq{$_}++; } print "master_letter_freq:\n"; print Dumper \%master_letter_freq; ##################### }
    Here is a new version of wm.pl:

    Update:
    I am using the improved code and so far no program issues have been found.
    The words in these puzzles are just crazy!
    list of letters or pattern: :lfseka
    list of letters or pattern: --e
    ale

    The correct word was FAE!

    "The most commonly accepted meaning of the word “fae” on the internet is that the word is a shortened abbreviation for the word “fairy.” “Fairy” in this sense meaning the mythical and playful, often mischievous, human-like woodland creatures from stories and legends."
    Perl cannot help with wacko stuff like that!

    Update:
    I just started a new puzzle with :buepol
    My very first guess was "bole" and it worked.
    GEEZ!
    my second guess was "plebe" - that didn't even count as a valid word! What ?!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11132769]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-18 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found