Method code for $climate._probabilities()

[Turn on line numbering]
arg from, season, fuzz;
var i, j, attr, refattr, dists, sum, t;

season = season in seasons;
refattr = from.attributes();
dists = map i in (weathers.keys()) to (refresh() && [i, 100 * weathers[i][season] / (fuzz + (type((t = (| map j in [1 .. (attr = i.attributes()).length()] to (abs(attr[j] - refattr[j])).sum() |))) == 'error ? 1000000 : t))]);

// normalize the list - the sum should be around 10,000
sum = dists.slice(2).sum();
return map i in (dists) to ([i[1], i[2] * 10000 / sum]);

["// Miroslav Silovic ", "// Created 12-Aug-1996 as a part of ColdCore, see: @help Credit"]

the Cold Dark