Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Text Based Perl Game

by smls (Friar)
on Dec 19, 2013 at 14:56 UTC ( [id://1067827]=note: print w/replies, xml ) Need Help??


in reply to Re: Text Based Perl Game
in thread Text Based Perl Game

The biggest item I'd like to point out is that your flow control is flawed. You're using subroutines to call themselves and each other without ever returning, causing the stack to get deeper and deeper. I'd suggest instead that you have a control loop like this: [...]

Another solution would be to call the non-returning subs like this:

goto &hallwayCommand;

This would prevent the call stack from growing. (See the last two paragraphs of goto for more info.)

Replies are listed 'Best First'.
Re^3: Text Based Perl Game
by roboticus (Chancellor) on Dec 19, 2013 at 15:41 UTC

    smls:

    It's certainly viable. However, I'm hoping to point him in the direction that will lead to the use of dispatch tables and data-driven architecture to simplify longer term maintenance and story changes.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-19 13:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found