What is the chance of getting 1 Ruby from a Fish?
Is it a 50% chance, or the chance of not getting a Ruby is higher?
I get only coins more often than I get Rubies.
What exactly is the chance of Rubies from a fish?
Arqade is a question and answer site for passionate videogamers on all platforms. It only takes a minute to sign up.
Sign up to join this communityWhat is the chance of getting 1 Ruby from a Fish?
Is it a 50% chance, or the chance of not getting a Ruby is higher?
I get only coins more often than I get Rubies.
What exactly is the chance of Rubies from a fish?
Let's take a look at the source code, shall we?
The script responsible for (currently) the fish and the bee is heroclickerlib.managers.HiddenObjectManager
.
Inside that script we find a function private function onHiderClick(param1:MouseEvent) : void
.
This function is responsible for the on-click event when you click the fish.
private function onHiderClick(param1:MouseEvent) : void
{
var _loc4_:* = 0;
var _loc5_:* = NaN;
var _loc6_:* = NaN;
this.removeHider();
if(Rnd.boolean(0.44))
{
_loc4_ = 1;
if(Rnd.boolean(0.04 + this._userData.ancients.doubleRubyPercent / 100))
{
_loc4_ = 2;
}
this._userData.addRubies(_loc4_,"hidden_object",-1);
_loc5_ = this._battleManager.display.mouseX;
_loc6_ = this._battleManager.display.mouseY;
this._battleManager.uiManager.battleUI.transientEffects.showGeneralMessage(_loc5_,_loc6_,_("+%s Ruby!",_loc4_));
}
var _loc2_:Monster = new Monster();
_loc2_.id = 2;
_loc2_.level = this._userData.highestFinishedZone + 1;
var _loc3_:Number = this._userData.getMonsterReward(_loc2_) * 10;
_loc2_.isBoss = true;
this._battleManager.itemDropManager.goldSplash(_loc3_,_loc2_,ServerTimeKeeper.instance.timestamp);
HeroClickerSoundManager.instance.playSoundEffectById(36);
this._battleManager.uiManager.battleUI.transientEffects.showGeneralMessage(580,152,"Yay!!");
}
Two function calls are important here:
if(Rnd.boolean(0.44))
: this internally checks if a (uniformly distributed) random number is less than 0.44. This evaluates to a chance of nearly exact 44% of at least one ruby.if(Rnd.boolean(0.04 + this._userData.ancients.doubleRubyPercent / 100))
: This rather lengthy call checks if a random number is less than 0.04 + the additional double ruby percentage of your ancients. This means that in 4% of all cases of getting a ruby, you get 2.The average amount of rubies you get after 1000 times clicking on the fish is: 444,4 => 44,44%
440 times at least one ruby
=> 440*4% = 11 times 2 rubies = 22 +
=> 440*96% = 422,4 times 1 ruby = 422,4
==> 444,4 rubies => ~444,4/1000 = 44,44% chance of getting one ruby on average
The expected amount of rubies per click is then 0,4444.
I used JPEXS Free Flash Decompiler to get to the source code.
Adding to @GiantTree's otherwise great answer:
The expected ruby count, E(R)
from a single clickable is:
E(R) = 1 * P(1) + 2 * P(2)
, (1)
where P(x)
is the probability of getting x
rubies.
Using @GiantTree's information as source, we see that double ruby is rolled for after the first one, meaning:
P(1) = 0.44 - P(2)
,
which means the (1) can be expressed as:
E(R) = 0.44 - P(2) + 2 * P(2) = 0.44 + P(2)
. (2)
Now, P(2)
can be calculated by:
P(2) = 0.44 * (0.04 + DRC)
,
where DRC
is your double ruby chance, expressed as a fraction (so 15% means DRC = 0.15
).
Finally, we insert this expression into (2):
E(R) = 0.44 + 0.44(0.04 + DRC) = 0.44 * (1.04 + DRC) = 0.4576 + 0.44 * DRC
.
Or for short:
E(R) = 0.4576 + 0.44 * DRC
.
This means the base expected value is 0.4576 rubies per clickable.
Since the highest value of the DRC
-boosting ancient is 15%, we get a maximum value (excluding relics) of:
Emax(R) = 0.4576 + 0.44 * 0.15 = 0.5236
,
meaning the maximum expected ruby yield (again, excluding relics) is 0.5236.