{}

Build your resume with HTML & CSS and win $100

Get featured on Programiz PRO and the Wall of Inspiration.

Build your resume with HTML & CSS and win $100

Join Challenge →
Join Challenge →

Build your resume with HTML & CSS and win $100

Get featured on Programiz PRO and the Wall of Inspiration.

Build your resume with HTML & CSS and win $100

Join Challenge →
Join Challenge →
run-icon
main.py
import numpy as np def simulate_once_with_flame_gold( total_pulls, pity_limit=80, ssr_rate=0.0075, sr_rate=0.12, flame_gold_cost=120, starting_pity=0, starting_last_ssrs=None, starting_flame_gold=0 ): pity = starting_pity limited_copies = 0 flame_gold = starting_flame_gold last_ssrs = list(starting_last_ssrs) if starting_last_ssrs else [] for _ in range(total_pulls): flame_gold += 1 # +1 base flame gold per pull if pity == pity_limit - 1: ssr_draw = True pity_triggered = True else: ssr_draw = np.random.rand() < ssr_rate pity_triggered = False if ssr_draw: # Hidden pity rule: determines next SSR type if len(last_ssrs) >= 2: if last_ssrs[-1] == 'S' and last_ssrs[-2] == 'S': ssr_type = 'L' # Guaranteed limited elif last_ssrs[-1] == 'L' and last_ssrs[-2] == 'L': ssr_type = 'S' # Guaranteed standard else: ssr_type = 'L' if np.random.rand() < 0.5 else 'S' else: ssr_type = 'L' if np.random.rand() < 0.5 else 'S' last_ssrs.append(ssr_type) if len(last_ssrs) > 2: last_ssrs.pop(0) if ssr_type == 'L': limited_copies += 1 else: flame_gold += 10 # +10 extra flame gold for standard SSR dupe if pity_triggered: pity = 0 else: pity += 1 # pity is not reset if SSR was pulled outside pity else: pity += 1 # Increase pity if no SSR # Check for SR pull (only within non-SSR pulls) if np.random.rand() < sr_rate / (1 - ssr_rate): flame_gold += 1 # +1 extra flame gold for SR dupe # Use flame gold to buy limited copies copies_from_shop = flame_gold // flame_gold_cost total_limited_copies = limited_copies + copies_from_shop return total_limited_copies def estimate_probability_flame_gold( total_pulls, target_copies, simulations=100000, starting_pity=0, starting_last_ssrs=None, starting_flame_gold=0 ): success = 0 for _ in range(simulations): if simulate_once_with_flame_gold( total_pulls, starting_pity=starting_pity, starting_last_ssrs=starting_last_ssrs, starting_flame_gold=starting_flame_gold ) >= target_copies: success += 1 return success / simulations def main(): print("🎯 Tower of Fantasy Limited Banner Simulation with Flame Gold 🎯") total_pulls = int(input("🎫 Total number of pulls: ")) target_copies = int(input("🎯 Target number of limited SSR copies (including shop purchases): ")) simulations = int(input("📊 Number of simulations (e.g. 100000): ")) starting_pity = int(input("⏱️ Current pity count (pulls since last pity SSR): ")) history_input = input("📜 Last two SSRs pulled (e.g. SL, SS, LS, LL or blank): ").upper().strip() if len(history_input) == 2 and all(c in ['S', 'L'] for c in history_input): starting_last_ssrs = list(history_input) else: starting_last_ssrs = [] starting_flame_gold = int(input("💰 Current amount of flame gold: ")) prob = estimate_probability_flame_gold( total_pulls, target_copies, simulations, starting_pity=starting_pity, starting_last_ssrs=starting_last_ssrs, starting_flame_gold=starting_flame_gold ) print(f"\n📈 Probability of obtaining at least {target_copies} limited SSR copies in {total_pulls} pulls: {prob * 100:.2f}%") if __name__ == "__main__": main()
Output