|We don't bite newbies here... much|
Re^5: Recursion: the Towers of Hanoi problemby abitkin (Monk)
|on Oct 25, 2004 at 14:38 UTC||Need Help??|
Basically, if you think about it, @_ has to be localized. Otherwise if you called a function inside a function (something I hope most of us do) your @_ array would be wiped out, leaving you with the parameters you sent into the child function you just called. The particular behavior your seeing is probably becuase the @_ array contains aliases to scalars.
Second, using 0 based discs is okay, it's easy enough for the user to add 1 in their head (or to start thinking like a cs person.)
Third, and this is where it gets interesting, when removing all the whitespace I can I get (for your solution):
Which just happens to be the same amount of space as (my solution):
so it seems that both solutions are (atleast as far as this little experiment goes) equal. My goal is to squeeze everything that I have now down to 115 or 110 by Tuesday.
Oh and I have compared our outputs, and with the exception of the disc number (mine being one less than yours) they are exactly the same.
Kwyjibo. A big, dumb, balding North American ape. With no chin.