Made by Hexay

Mathematics Behind Case Opening

Discover the mathematical concepts and calculations that power 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

🧮 Core EV Formula
EV = Σ(probabilityi × valuei)
probabilityi = chance of getting item i
valuei = market value of item i
The probability for each item is calculated as:
probabilityi = 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:

💎 Blue Gem EV Formula
EVcase_hardened = (non_blue_patterns/1000 × base_value) + Σ(tier_patternsi/1000 × tier_valuei)
non_blue_patterns = number of non-blue gem patterns (out of 1000)
tier_patternsi = number of patterns in tier i
tier_valuei = 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.

📊 Risk Calculation Formulas
Variance = Σ(probabilityi × (valuei - 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
Total Profit ~ N(n×μ, n×σ²)
μ = net expected value per case
σ = standard deviation per case
n = number of cases
🚫 Bankruptcy Avoidance
P(Total Profit > -Bankroll) = C
This leads to:
n = (z×σ/μ)²
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.

🔢 Confidence Calculation Process
For a given bankroll B that allows n cases:
n = B/case_price
The z-score for bankruptcy avoidance is:
z = (n×μ)/(√n×σ)
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

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

📊 Average Price Calculation Process
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
avg_price = Σ(sharei × price(midpointi))
sharei = probability of wear category i
midpointi = middle float value in category i
price() = price function based on item type

⚠️ Assumptions and Limitations

🎲 Independence
Each case opening is assumed to be independent of previous openings.
📊 Normal Distribution
For large numbers of cases, we assume the total profit follows a normal distribution (Central Limit Theorem).
💰 Market Stability
Calculations assume item values remain relatively stable during the case opening session.
🔢 Pattern Distribution
For Case Hardened items, we assume pattern numbers are uniformly distributed.