Bug Report: Teledahn

Announcements and discussion regarding the Gehn CWE Shard.

Moderator: Gehn Shard

Re: Bug Report: Teledahn

Postby johnsojc » Sat Mar 17, 2012 6:58 am

Not to mention whrandom was not threadsafe and random is. I suspected something odd was being returned by the observed behavior. Great work D'Lanor!

Looks like this one can be put to bed... unless there are other places that use random (this was just the randint() part of the script was it not?)
johnsojc
 
Posts: 246
Joined: Sun Dec 07, 2008 10:27 am

Re: Bug Report: Teledahn

Postby Branan » Sat Mar 17, 2012 7:32 am

Other scripts probably use random - animal events in pods come to mind. We'll want to double-check that those seed the RNG in a sane fashion.
Image
Your friendly neighborhood shard admin
User avatar
Branan
Gehn Shard Admin
 
Posts: 694
Joined: Fri Nov 16, 2007 9:45 pm
Location: Portland, OR

Re: Bug Report: Teledahn

Postby D'Lanor » Sat Mar 17, 2012 7:33 am

johnsojc wrote:Looks like this one can be put to bed... unless there are other places that use random (this was just the randint() part of the script was it not?)

There are. And many of them have random.seed() under OnFirstUpdate... :?
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Bug Report: Teledahn

Postby Acorn » Sat Mar 17, 2012 7:35 am

Great work! BUT we're not quite there - D'Lanor, quitting doesn't reset the number. I've had 25 as my first number over several days with lots of quits over the period. Just quit and tried again - still 25. The sequence seems to fix itself right at the start, and never resets. Can anyone puzzle out why?
Image
Acorn
 
Posts: 724
Joined: Sun Feb 26, 2012 9:56 am

Re: Bug Report: Teledahn

Postby D'Lanor » Sat Mar 17, 2012 7:47 am

Acorn wrote:Great work! BUT we're not quite there - D'Lanor, quitting doesn't reset the number. I've had 25 as my first number over several days with lots of quits over the period. Just quit and tried again - still 25. The sequence seems to fix itself right at the start, and never resets. Can anyone puzzle out why?

Then it doesn't even seed properly at import. Which probably makes sense because the import takes place before OnFirstUpdate. I'm not sure what it falls back on if even that fails. Calling random.seed() later should fix it anyway.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Bug Report: Teledahn

Postby johnsojc » Sat Mar 17, 2012 8:06 am

There's a lot of strange code in the seed() function as well as some weird juggling depending on whether the O/S is 32 or 64 bit.

Code: Select all
        """Initialize internal state from hashable object.

        None or no argument seeds from current time or from an operating
        system specific randomness source if available.

        If a is not None or an int or long, hash(a) is used instead.
        """


Expedient: do the extra call for a new seed and make it work...
Elegant: figure out why it doesn't work in the first place and impress everyone.
Recommend: do the expedient and look into the deeper problem at your leisure for the elegant solution
johnsojc
 
Posts: 246
Joined: Sun Dec 07, 2008 10:27 am

Re: Bug Report: Teledahn

Postby johnsojc » Sat Mar 17, 2012 9:01 am

Branan wrote:Other scripts probably use random - animal events in pods come to mind. We'll want to double-check that those seed the RNG in a sane fashion.


I just checked both Payiferen and Negilahn. Unfortunately I arrived during night (daybreak in Negilahn in less than half an hour). This means all spawns were calculated for the current day so they have already passed.

I got two spawns for the monkey and only 1 for the Urwin in Neg. Only having one spawn seems odd but is probably not impossible. However I did not get any spawns for the Sandscrit in Pay... the very first spawn was after sunset - something I've never seen before. It's been awhile since I looked at the code but IIRC, the march of the Urwin and Sandscrit is based on a random number of steps and whether they bellow or not or pause to eat and possibility the path they take. I need to observe the Sanscrit since it is the easiest to watch (if it doesn't walk behind the pod out of view).

Due to the way spawns are generated, I won't be able to check this again for about 16 hours. I will peek at Minkata Shard to see what kind of spawn time I get there to compare... if I wait a bit I can get valid times for today. I wonder if I still have my appearance prediction spreadsheet... It was very handy at calculating the actual time of an appearance.

Edit: OK, I checked on the code for Neg, Pay, and Teledahn. They all imported random and have the seed generation set for OnFirstUpdate. I also noticed that the code forces an appearance during the first 5 hours of daylight so I should not have gotten the no spawn for the Sandscrit in Pay that I logged. Spawns are generated from 1 to 7 hours after the first spawn until the calculated spawn time is after sunset. It's looks like we may have a problem with the pods as well as Teledahn. I wish I could understand how this code works better... I have to go with feel more than understanding. I feel there is a fundamental issue with random.py that is causing these issues but I couldn't point and say there it is. I usually can crawl around in code and locate a problem even if I don't have the skill to fix it... an odd talent but there it is. What did whrandom do that random doesn't?

Another edit: I misread the log for Payiferen. I did get a spawn for the Sandscrit and it is entirely possible to only get the one spawn for an encounter. Now I'm not sure if the pods are working properly or not... I shall continue to observe and keep my mouf shut until I'm sure I've found something.
johnsojc
 
Posts: 246
Joined: Sun Dec 07, 2008 10:27 am

Re: Bug Report: Teledahn

Postby johnsojc » Sat Mar 17, 2012 1:30 pm

Stupid question... Is case important in Python names? I noticed that random.py was instantiated as _inst = Random() and you are importing random.
johnsojc
 
Posts: 246
Joined: Sun Dec 07, 2008 10:27 am

Re: Bug Report: Teledahn

Postby Paradox » Sat Mar 17, 2012 9:31 pm

The module is called random, the class is called Random. That's a fairly typical pattern in Python.

Case does matter for Plasma Modifier/Responder files, the filename and the class name must match exactly.
Paradox
 
Posts: 1290
Joined: Fri Sep 28, 2007 6:48 pm
Location: Canada

Re: Bug Report: Teledahn

Postby johnsojc » Sun Mar 18, 2012 6:07 am

I was following a curious chain of logic... that since the pods' use of random number generator routines were coded somewhat the same way as teledahn's, then some problem should show up in the pods if the problem was in in the random code or not if the problem was in the teledahn code. As of this moment checking Payiferen, I had 4 valid spawns of the sandscrit (two already past) with one scheduled in just over an hour which I hope to observe. The pod seems to be working properly using random.py.

My understanding of Python is so trivial, I'll just have to refrain from asking anything because I don't seem to know enough to ask even good stupid questions. Now I remember why I quit programming for a living 15 years ago.

Update: Negilahn seems to be working properly as well... 3 spawns scheduled for the monkey, 2 for the Urwin. I might even be able to see one monkey (in 45 min) and one Urwin (in 2:15). The number and times for the spawns differ from the ones for the preceding day so I'm not seeing the duplication of random values D'Lanor saw from the Teledahn code.

Update 2: The Negilahn monkey triggerd on schedule however, having a 50-50 chance of looking out the correct window, I picked the wrong one. I heard the monkey cheep (verified by the log) so an appearance did occur even though I didn't see it. It seems that random.py is working properly for the pods. Why it is acting up in Teledahn I will leave to the Python gurus to figure out. I will check for new random spawn times just after next sunrise (9 or 10 hours from now I think).

If a new seed is supposed to be generated OnFirstUpdate, is an update happening before I try to lure Shroomie in? Or is the seed generation failing or simply not being passed globally? Why does it seem to start working normally once you get past those first 25 pulls of the feeder lever?
johnsojc
 
Posts: 246
Joined: Sun Dec 07, 2008 10:27 am

PreviousNext

Return to Gehn Shard

Who is online

Users browsing this forum: No registered users and 0 guests