[][src]Struct mc_sim::stats::EnderPearlDistribution

pub struct EnderPearlDistribution { /* fields omitted */ }

Implementations

impl EnderPearlDistribution[src]

pub fn new(
    ender_pearl_target_total: u32,
    ender_pearl_target_per_run: u32,
    drop_list: &[DropConfig]
) -> Result<Self, McSimError>
[src]

Creates a distribution that has a probability mass function that represents the number of expected failed barters (trades where you did not get pearls) given the number of pearls targeted over a "stream" and the average target pearl drops in that stream.

This distribution is most accurate when all runs within the stream have the same target pearl drops. Deviating from that by much creates an offset in the data, that provides an unrealistic favourability towards good luck typically.

When constrained in this way, this distribution is fairly accurate. For this reason, I suggest that you feed in modified data rather than the exact run data from dream's streams. I.E. I took all runs that made it beyond 10 pearls (17 runs) and then set the target to 10 across the board. This is what I consider to be the most fair to Dream, since 10 pearls is a typical target number and the exact number you get to isn't relevant. Now, you can simply ask how many trades it took to arrive at 10 pearls for those 17 streams, and then compare that with this distribution to get "Dream's luck".

Alternatively, you can feed in exact run data, however, put each run in a separate "stream" in the simulator. Then, average the results over all streams.

// Estimates the probability of Dream's luck for his 17 runs that got 10+ pearls.
// It is not possible from the vods to know exactly how many barters it took dream
// to get these results, so I have taken the worst case number of barters (239),
// which makes this test *highly* favoured towards dream.
// favoured number of 235 required barters.
let number_of_runs = 17;
let barters_made = 239;
let successful_barters = 39;
let ender_pearl_target_per_run = 10;
let ender_pearl_target_total = ender_pearl_target_per_run * number_of_runs;

let drop_list = drop_list::barter_drop_list(ender_pearl_target_total, ender_pearl_target_per_run);
let probability_of_dream_luck = drop_list.distribution().unwrap().luck(barters_made, successful_barters);

// This produces a slightly different number than the mods paper, because I'm simulating trades where
// the number of pearls dropped is also a variable. Thus, I am not asking the same question they did.
assert_eq!(probability_of_dream_luck, 0.0000000006713608557973316);

pub fn distribution(&self) -> &NegativeBinomial[src]

Gets the negative binomial distribution for ender pearls, for the target number of pearls in total and per run.

pub fn luck(&self, total_barters_made: u32, successful_barters: u32) -> f64[src]

An estimate of the luck of the total number of barters and number of successful barters resulting in the target number of ender pearls, based on this distribution.

pub fn probability(
    &self,
    total_barters_made: u32,
    successful_barters: u32
) -> f64
[src]

An estimate of the probability of the specific total number of barters and number of successful barters resulting in the target number of ender pearls, based on this distribution.

Trait Implementations

impl Clone for EnderPearlDistribution[src]

impl Copy for EnderPearlDistribution[src]

impl Debug for EnderPearlDistribution[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,