F
Felix Nawothnig
Hi.
Seems I ran into a Heisenbug - the behaviour of my application changes
when I add or remove non-relevant code somewhere - seems it doesn't
really matter where. For that reason I can't really debug or isolate the
bug. :/
I've uploaded the application at:
http://noegnud.sf.net/flgr/foobar.tar.gz
It's about 630 lines. It's a incomplete framework for (german)
textadventures (sorry about the german text - all classnames etc. are
english tho)
At basicthing.rb:315 I added a puts which made the program work:
flexo@majestix foobar $ ruby gold.rb
...
{:ipreps=>[], :verb=>["norden", "n"], :dpreps=>[]} (norden == north)
Heisenbug!
Du bist in einem dichtem Nadelwald. (This is the description of the new
room - the player went to north)
The loop at basicthing.rb:248-323 is supposed to iterate through all
actions until it finds a matching one (checking the prepositions and
number of objects) and then executes the action's proc.
(The action for "n" (short for "Norden" - north in german) is defined
at evolution.rb:20.)
When I remove basicthing.rb:315 I get:
{:ipreps=>[], :verb=>["osten", "o"], :dpreps=>[]}
{refix=>["runter", "herunter", "raus", "heraus"], :ipreps=>["vom",
"von", "aus"], :verb=>["n", "nimm", "nehm", "nehme"], :iobj=>ptional,
:dobj=>:required, :dpreps=>[]}
{:ipreps=>[], :verb=>["unten", "u"], :dpreps=>[]}
{:ipreps=>[], :verb=>["s\374den", "s"], :dpreps=>[]}
{:ipreps=>[], :verb=>["norden", "n"], :dpreps=>[]}
{:ipreps=>[], :verb=>["oben", "ob"], :dpreps=>[]}
{:ipreps=>[], refix=>["um"], :verb=>["schau", "schaue"],
:dobj=>ptional, :dpreps=>[]}
{:ipreps=>[], refix=>["hin", "rein", "herein"], :verb=>["geh",
"gehe"], :dobj=>:required, :dpreps=>["nach", "zum", "zu", "in"]}
{:ipreps=>[], :verb=>["westen", "w"], :dpreps=>[]}
Ich verstehe nicht.
("Ich verstehe nicht" == "I don't understand" - no matching action could
be found)
As you can see it did check for the "move north" action:
{:ipreps=>[], :verb=>["norden", "n"], :dpreps=>[]}
But for some reason it decided that it doesn't match. I can't figure out
why since adding debug-statements breaks/unbreaks it again...
Actually the "puts" doesn't really matter - removing or adding more
rooms or objects causes the behaviour to change, removing properties of
objects does, hell, even changing the (ignored) return-value of some
#properties methods does.
Running it with -d also makes the bug go away for me.
So does set_trace_func().
Someone in #ruby-lang reported the opposite behaviour with the same code
(breaks *with* the puts, runs fine without) and different behaviour
between different ruby versions.
22:41 <@dblack> fn: you can use me as a witness if you want
I'm not doing really exotic stuff so... looks like a ruby-bug for me.
Would be nice if someone would take a look at it.
-flexo
Seems I ran into a Heisenbug - the behaviour of my application changes
when I add or remove non-relevant code somewhere - seems it doesn't
really matter where. For that reason I can't really debug or isolate the
bug. :/
I've uploaded the application at:
http://noegnud.sf.net/flgr/foobar.tar.gz
It's about 630 lines. It's a incomplete framework for (german)
textadventures (sorry about the german text - all classnames etc. are
english tho)
At basicthing.rb:315 I added a puts which made the program work:
flexo@majestix foobar $ ruby gold.rb
...
{:ipreps=>[], :verb=>["s\374den", "s"], :dpreps=>[]} (sueden == south)
{:ipreps=>[], :verb=>["norden", "n"], :dpreps=>[]} (norden == north)
Heisenbug!
Du bist in einem dichtem Nadelwald. (This is the description of the new
room - the player went to north)
The loop at basicthing.rb:248-323 is supposed to iterate through all
actions until it finds a matching one (checking the prepositions and
number of objects) and then executes the action's proc.
(The action for "n" (short for "Norden" - north in german) is defined
at evolution.rb:20.)
When I remove basicthing.rb:315 I get:
{:ipreps=>[], :verb=>["i", "inv", "inventar"], :dpreps=>[]}
{:ipreps=>[], :verb=>["osten", "o"], :dpreps=>[]}
{refix=>["runter", "herunter", "raus", "heraus"], :ipreps=>["vom",
"von", "aus"], :verb=>["n", "nimm", "nehm", "nehme"], :iobj=>ptional,
:dobj=>:required, :dpreps=>[]}
{:ipreps=>[], :verb=>["unten", "u"], :dpreps=>[]}
{:ipreps=>[], :verb=>["s\374den", "s"], :dpreps=>[]}
{:ipreps=>[], :verb=>["norden", "n"], :dpreps=>[]}
{:ipreps=>[], :verb=>["oben", "ob"], :dpreps=>[]}
{:ipreps=>[], refix=>["um"], :verb=>["schau", "schaue"],
:dobj=>ptional, :dpreps=>[]}
{:ipreps=>[], refix=>["hin", "rein", "herein"], :verb=>["geh",
"gehe"], :dobj=>:required, :dpreps=>["nach", "zum", "zu", "in"]}
{:ipreps=>[], :verb=>["westen", "w"], :dpreps=>[]}
Ich verstehe nicht.
("Ich verstehe nicht" == "I don't understand" - no matching action could
be found)
As you can see it did check for the "move north" action:
{:ipreps=>[], :verb=>["norden", "n"], :dpreps=>[]}
But for some reason it decided that it doesn't match. I can't figure out
why since adding debug-statements breaks/unbreaks it again...
Actually the "puts" doesn't really matter - removing or adding more
rooms or objects causes the behaviour to change, removing properties of
objects does, hell, even changing the (ignored) return-value of some
#properties methods does.
Running it with -d also makes the bug go away for me.
So does set_trace_func().
Someone in #ruby-lang reported the opposite behaviour with the same code
(breaks *with* the puts, runs fine without) and different behaviour
between different ruby versions.
22:41 <@dblack> fn: you can use me as a witness if you want
I'm not doing really exotic stuff so... looks like a ruby-bug for me.
Would be nice if someone would take a look at it.
-flexo