Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in alien alloy calculation in borehole #735

Open
arnablegend opened this issue Aug 24, 2024 · 0 comments
Open

Bug in alien alloy calculation in borehole #735

arnablegend opened this issue Aug 24, 2024 · 0 comments

Comments

@arnablegend
Copy link

arnablegend commented Aug 24, 2024

I noticed in the fandom page that Borehole will give 1-3 alien alloys for the first visit with some probability. Are the chances of getting either 1, 2 or 3 alien alloys intended to be equal? If yes, the code does not seem to confirm to that.

To elaborate, loot calculation is handled by the following code in events.js:927
var num = Math.floor(Math.random() * (loot.max - loot.min)) + loot.min;
Math.random() returns x, a float, where 0 <= x < 1
Since loot.max = 3 and loot.min = 1 for boreholes, we get Math.floor(y) where 0 <= y < 2.
So, num will always be either 1 or 2.

This applies to loot calculation in the entire game.

IMHO, the correct implementation should have been

var num = Math.floor(Math.random() * (loot.max + 1 - loot.min)) + loot.min;

And I could be completely wrong and the game is designed to give only 1-2 alien alloy on the undiscovered visits. :)

@arnablegend arnablegend changed the title Random chance for alien alloys Equal probabilities for alien alloys in borehole? Aug 24, 2024
@arnablegend arnablegend changed the title Equal probabilities for alien alloys in borehole? Bug in alien alloy calculation in borehole Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant