I tested again Barbarians quests and noticed the following:
- I was still able to cheat during a certain time before I got killed: inma and frillyar. Even if fluffies killed by frilliar are not counted, killing extra mobs can help.
- I tried to drop food items one by one and by various numbers. The probabilities to get a certain number of extra mobs while dropping n items separately or at once appears to be different and it should not be the case
I will discuss here only the second point.
The cause of the problem as we could see in a discussion I had with Jenalya is the uniform distribution generated by the function
rand(). This distribution should not be uniform. I suggest the following algorithm in pseudo-code form.:
Code: Select all
// generation of a binary random variable X with probability p of being one ( Bernouilli alternative). Each X=1 in a trial will make an xtra mob spawned.
//p belongs to [0, 1] interval and can be a function of the character level, but should stay relatively low or the quest may become unfeasible to high levels.
//I assume here that rand(0,1) returns a random real number uniformly distributed in [0, 1] as described in the wiki.
//The optional argument lets you vary the seed of the sequence .
//
if (rand(0,1)≤p) then X:=1 else X:=0; // rand(1)
//
//generation of a random integer variable Y Y = k in {0, 1, 2 , ... n}, which will be the number of mobs spawned.
//[i]n[/i] is the number of food items dropped. Trials are supposed to be independent, thus Y is the sum of n previous X variables (Binomial variable).
Y:=0
repeat from i = 1 to n {
if rand(0,1)≤p then X:=1 else X:=0;
Y:= Y+X;}
//
//there are faster ways to generate Y with large trial number n but I could not find the necessary math functions in doc.
//then you call spawn (Y [mobs #], mobmaxlevel(char(level)));
//
note: I'm not sure that it is necessary to have the probability of the mob number to increase if their level does.