Made by Hexay

Mathematics Behind Case Opening

This page explains the mathematical concepts and calculations used to determine expected values, required bankrolls, and probabilities in our case opening simulator.

Expected Value (EV) Calculation

The expected value of opening a case is calculated using probability theory and represents the average amount you would receive if you opened the case an infinite number of times.

Basic Formula

For each case, we calculate:

EV = Σ(probability_i × value_i)

Where:

  • probability_i = chance of getting item i
  • value_i = market value of item i

The probability for each item is calculated as:

probability_i = (rarity_chance / items_in_rarity)

Special Cases: Blue Gems

For Case Hardened items that can be Blue Gems, we adjust the expected value calculation to account for pattern probabilities:

EV_case_hardened = (non_blue_patterns/1000 × base_value) + Σ(tier_patterns_i/1000 × tier_value_i)

Where:

  • non_blue_patterns = number of non-blue gem patterns (out of 1000)
  • tier_patterns_i = number of patterns in tier i
  • tier_value_i = value of blue gems in tier i

Variance and Risk Calculation

To understand the risk and calculate required bankrolls, we need to know how much the returns can vary from the expected value.

The variance is calculated as:

Variance = Σ(probability_i × (value_i - EV)²)

The standard deviation (σ) is then:

σ = √Variance

Required Bankroll Calculation

The required bankroll is calculated to ensure you have enough money to avoid bankruptcy with a specified confidence level.

Mathematical Model

We model the total profit after n cases as a normal distribution:

Total Profit ~ N(n×μ, n×σ²)

Where:

  • μ = net expected value per case
  • σ = standard deviation per case
  • n = number of cases

Bankruptcy Avoidance

To avoid bankruptcy with confidence level C, we need:

P(Total Profit > -Bankroll) = C

This leads to:

n = (z×σ/μ)²

Where:

  • z = z-score for confidence level C
  • Required bankroll = n × case_price

Bankroll Confidence Calculation

Given a user's bankroll, we calculate the probability they won't go bankrupt.

For a given bankroll B that allows n cases:

n = B/case_price

The z-score for bankruptcy avoidance is:

z = (n×μ)/(√n×σ)

The confidence level is then:

Confidence = Φ(z) × 100%

Where Φ is the standard normal cumulative distribution function.

Float Values and Price Adjustment

Each item has a float value (wear) that affects its price. We calculate average prices by considering the distribution of possible float values and their corresponding price impacts.

Float Ranges by Category

  • Gloves: 0.06 - 0.80
  • Special Knives: (Karambit, Doppler, Fade) 0.00 - 0.08
  • Rust Coat Knives: 0.40 - 1.00
  • Other Knives: 0.00 - 0.80
  • Regular Items: 0.00 - 1.00

Wear Categories

Items are divided into wear categories based on float value:

  • Factory New (FN): < 0.07
  • Minimal Wear (MW): 0.07 - 0.15
  • Field-Tested (FT): 0.15 - 0.38
  • Well-Worn (WW): 0.38 - 0.45
  • Battle-Scarred (BS): 0.45 - maxFloat

Price Calculation

Gloves (High Value > $1000)

Price multipliers by wear:

  • FN: 1.0× base value
  • MW: 0.25× base value
  • FT: 0.154× base value
  • WW: 0.143× base value
  • BS: 0.125× base value

Gloves (Regular Value ≤ $1000)

  • FN: 1.0× base value
  • MW: 0.4× base value
  • FT: 0.333× base value
  • WW: 0.286× base value
  • BS: 0.25× base value

Regular Items

For float value f, price is calculated as:

  • FN: base × (1 - f/4)
  • MW: base × (1 - f/5) / 1.1
  • FT: base × (1 - f/6) / 1.2
  • WW: base × (1 - f/7) / 1.3
  • BS: base × (1 - f/8) / 1.5

Average Price Calculation

To calculate the average price of an item:

  1. Determine the item's float range based on its category
  2. Split the float range into wear categories
  3. Calculate the share (probability) of each wear category: share = (category_max - category_min) / (max_float - min_float)
  4. For each wear category:
    • Calculate the midpoint float value
    • Calculate the price at that float value
    • Multiply by the category's share
  5. Sum all weighted prices to get the final average price

The formula can be expressed as:

avg_price = Σ(share_i × price(midpoint_i))

Where:

  • share_i = probability of wear category i
  • midpoint_i = middle float value in category i
  • price() = price function based on item type

Assumptions and Limitations