Daniel Staal wrote: > --As of Thursday, February 19, 2004 6:31 PM -0500, Joel is alleged to have > said: > > > Here it is. Okay so it isn't tommorow. I shortened it a bit, but its the > > same really. > > --As for the rest, it is mine. > > Here's a first approximation of a rewrite. ;-) (Major problem: it always > asks what you want to do twice...) > > This version keeps track of the state of the game, and uses that to guide > the flow. Note that I actually did put commands in a variable... > > However, now each location you can go to is entirely independent of any > other. > > I'm sure this can be simplified. It's just the first treatment I thought > of. > > Daniel T. Staal
I don't know about this Daniel. Even for all its goto's, I found the original more reaable. I think Joel needs to understand that Perl function calls need no extra verbs, and that closing braces should align vertical with the beginning of the line that opens the block, but otherwise his code is very nice and tight. In particular, I feel that the insertion of gratuitous blank lines detracts from the overall readability. If anything, I would have modified those assignments by breaking the lines, using the concatenation operator, to bring the whole assignment statement into view. my $bridge = "\nYou are on the bridge. There is a red light flashing on the main console.\n" . "There are doorways to the north, south, and west.\n"; my $bridge2 = "\nYou are on the bridge. You can see out the window that the ship has landed on an unknown planet.\n" . "There are doorways to the north, south and west\n\n"; Since there is no requirement to complete statements, or even strings, on a single line, it would be good to highlight this flexibility for new users of Perl. For me at least, bringing the whole statement into a narrower horizontal frame makes it much easier to keep track of. It looks like Joel is on the right track in terms of overall logic. He just needs to work on his indentation a little, and learn modern syntax for defining subroutines in Perl. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>