Ticket ID: |
#333 |
Bug Report: | $problem_report_329 |
Reported From: | the Pit ($the_pit) |
Reported By: | Stephen ($user_stephen) |
Reported On: | 23-Jul-1999 |
Resolved: | UNRESOLVED |
Claimed: | UNCLAIMED |
Bug Group: | |
Summary: | possible problem in $climate.advance, resubmitted |
| |
Second try, with better formatting.
I think I've found another bug in the weather routines, this time in $climate.advance.
dists = ._probabilities(current, season, fuzz);
dists = dists.sort(dists.slice(2));
At this point, dists is a list of probabilities normalized to 10000.
for i in (dependancies) {
d = (i[1]).get_setting("weather-time", $realm);
dists += ((i[2]) * ((d[3])._probabilities(d[1], d[2], fuzz))) / 100;
}
Here is the code that deals with the inter-realm weather dependancy (a really neat idea, by the way!). Dists has been extended with a bunch of new probabilities; the sum is now greater than 10000 (if there were any dependancies). For instance, if there were 6 dependancies at 50% each, the sum of dists is now 40000.
w = random(10000);
But the random generator only look at the probabilities less than 10000. It does not account for the added probabilities of the dependancies.
Either dists needs to be renormalized to 10000 here, or random() needs a different argument, perhaps dists.sum.
| |
|