Page 1 of 1
Recursion in Hugo
Posted: Tue May 17, 2011 8:55 pm
by Ice Cream Jonsey
I had some code that was like this:
location DoUrinate
{
Perform(&DoUrinate, hole01)
}
hole01 was in the room. Basically, One of the Bruces typed >piss in hole
That caused the game to crash, as the above forms a loop. An endless loop!
This was meant to be a blog post, but I have a billion things to do before my brother's inexplicable wedding, not the least of which is using the word inexplicable in most posts.
Thanks, Bruce.
Posted: Tue May 17, 2011 9:15 pm
by Flack
Maybe he just had to piss really bad!
Like, really, really, really bad.
Like ...
10 print "really, "
20 goto 10
... bad.
Re: Recursion in Hugo
Posted: Wed May 18, 2011 11:56 am
by Tdarcos
Ice Cream Jonsey wrote:I had some code that was like this:
location DoUrinate
{
Perform(&DoUrinate, hole01)
}
hole01 was in the room. Basically, One of the Bruces typed >piss in hole
That caused the game to crash, as the above forms a loop. An endless loop!
This was meant to be a blog post, but I have a billion things to do before my brother's inexplicable wedding, not the least of which is using the word inexplicable in most posts.
Thanks, Bruce.
Actually, you're lucky it's a subroutine call, this uses memory for the stack frame and makes the game (eventually) use all available memory. If it was a branch it would just hang.
Trap Code
Posted: Fri Feb 10, 2012 4:26 am
by Tdarcos
Tdarcos wrote:Ice Cream Jonsey wrote:That caused the game to crash, as the above forms a loop. An endless loop!
Thanks, Bruce.
Actually, you're lucky it's a subroutine call, this uses memory for the stack frame and makes the game (eventually) use all available memory. If it was a branch it would just hang.
I have a method I use - I'm writing a cross-reference for Pascal Programs, something that has been really weak compared with what was available back on mainframe compilers - is a "trap code". Any place where something is happening, a global variable called TrapCode is set to 0 the first time it is entering an area. Every time it passes through the critical area, TrapCode is incremented. If it's not supposed to get more than, say, 5 or 6 loops I'll set the check on TrapCode so that if it reaches 50, it raises a flag that causes it to print a message and pause until ENTER is pressed, allowing me to see when a runaway program occurs.
Posted: Fri Feb 10, 2012 4:36 am
by Tdarcos
Flack wrote:Maybe he just had to piss really bad!
Like, really, really, really bad.
Like ...
10 print "really, "
20 goto 10
... bad.
"I'd give a million dollars just to be able to take a piss without it hurting."
- Hyman Roth,
The Godfather, Part 2