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

Clarify how per-slot and per-shop probability is used #31

Open
adamthedog opened this issue Dec 28, 2021 · 2 comments
Open

Clarify how per-slot and per-shop probability is used #31

adamthedog opened this issue Dec 28, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@adamthedog
Copy link

Currently, the website is unclear in how the game uses the probabilities listed to fill slots with animals.
The per-slot probability implies that the game uses a discrete random number for every slot and uses the weights to pick an animal to put in that slot.
As an example to illustrate for others, here's what a per-slot random weighted choice might look like in Python:

import numpy
def number_of_slots(turn):
    if turn <= 4: return 3
    elif 5 <= turn <= 8: return 4
    elif 9 <= turn: return 5

animals = ("A", "B", "C", "D")
animal_weights = (
    # A,  B,   C,   D
    (.3, .3,  .4,  .0),  # turn 1
    (.2, .2, .35, .25),  # turn 2
    (.1, .1,  .4,  .4)   # turn 3
)

r = numpy.random.default_rng()
turn = X  # whatever turn it is currently
animals_in_shop = list(r.choice(a=animals, size=number_of_slots(turn), p=animal_weights[turn]))

where the var animals_in_shop is the list of final animals in the shop.
However, I'm not sure (and I'm sure others have encountered the same issue) what the per-shop weight means. Is that a cumulative probability of each animal appearing while factoring in all slots plus rolls? Is it a weight in some separate random choice that isn't discrete with respect to individual shop slots?

I'd really appreciate a clarification in the comments here, and maybe eventually the information can be added to the website.
As an additional aside/request, where is the prob. data from? Is it calculated from testing, or is it somehow mined from the game?
Thanks!

@bencoveney bencoveney added the enhancement New feature or request label Jan 3, 2022
@bencoveney
Copy link
Owner

Hi @adamthedog

The probabilities at the moment are calculated as follows:

  • For each turn, count the number of pets/food available.
  • All pets/food are assumed to be equally likely, I do no have any weights (or the information available to calculate/look up weights, if they exist).
  • The likelyhood that each pet/food will appear in a shop and slots is then calculated, given the number of slots available for that turn.

I understand that the sloth is a rare easter egg which would effectively have a very low weight if percentages were calculated that way, however at the time I was not able to find any information on the appearance probability so I just excluded it from the calculations.

The code that calculates those probabilities is here:
https://github.com/bencoveney/super-auto-pets-db/blob/main/src/db/populateProbabilities.ts

I exclude the sloth from calculations here:
https://github.com/bencoveney/super-auto-pets-db/blob/main/src/db/populateProbabilities.ts#L26

Either way, having a bit more background information easily available on how these values are populated sounds like a good idea to me!

@adamthedog
Copy link
Author

Ah, so the per-animal probabilities in the game are actually just equal chances and the website's probabilities listed are a function of the equal chances and amount of slots available, I see!

I guess the sloth is likely calculated by a simple random chance that succeeds or fails to replace a slot with a sloth when the server generates the shop items.

I may make a PR that adds a clarification regarding this clarification of what the stats mean.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants