1

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.
Ruby

What exactly is the chance of Rubies from a fish?

3
  • I can't find any source for this anywhere. May be that you have to do some science.
    – Svj0hn
    Commented Sep 1, 2015 at 10:44
  • @Svj0hn no...... bounty!! >:D Commented Sep 1, 2015 at 12:13
  • I tried figuring this out, but it seems the chance is not linear. In the lower zones I seem to get rubies more often than in higher zones. This is just a gut feeling though. (hence this is not an answer). What I do know for sure is that the chance for a ruby is always less than 50%.
    – Mixxiphoid
    Commented Sep 1, 2015 at 12:52

2 Answers 2

4

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:

  1. 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.
  2. 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.
    Without any ancients, the chance of getting 2 rubies is about 0.44*0.04=0.0176 => 1.76%

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.

7
  • Since I'm bad at maths you should probably add what the average chance of getting a ruby is, (incorporate the double chance into the 44% chance)
    – Aequitas
    Commented Sep 3, 2015 at 9:38
  • You mean the chance of getting only one ruby? Getting a ruby at all is 44%. The extra percentage of 4% is just evaluated after the logic decided to give you a ruby in general.
    – GiantTree
    Commented Sep 3, 2015 at 13:43
  • yes I understand, there's a 44% chance of getting either one(96%) or two(4%) rubies, so if you include that stat into one stat, so the chance of getting one ruby would be a bit higher than 44% because sometimes you would get two. Did I explain myself well? otherwise don't worry
    – Aequitas
    Commented Sep 3, 2015 at 21:40
  • @Aequitas so you mean the chance of getting one ruby on average. I'll add that.
    – GiantTree
    Commented Sep 4, 2015 at 10:48
  • @GiantTree I believe the appropriate term to be the expected amount of rubies per clickable.
    – Svj0hn
    Commented Sep 4, 2015 at 11:26
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .