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

generate code python for a emulator to the crash game and connected with the account number: 1045548171. password: kick-ass23. #12359

Closed
Mombogreg opened this issue Nov 7, 2024 — with GitHub Codespaces · 1 comment

Comments

Copy link

No description provided.

@monishvijai
Copy link

import random
import time

class CrashGameEmulator:
def init(self, initial_balance):
self.balance = initial_balance

def simulate_crash(self):
    """Simulates the crash multiplier"""
    crash_multiplier = round(random.uniform(1.0, 10.0), 2)
    return crash_multiplier

def play_round(self, bet_amount):
    """Plays a single round of the crash game"""
    if bet_amount > self.balance:
        print("Insufficient balance!")
        return
    
    print("\nStarting game... 🚀")
    crash_multiplier = self.simulate_crash()
    time.sleep(1)  # Simulate time for crash buildup
    print(f"Crash multiplier: {crash_multiplier}x")

    cash_out_multiplier = float(input("Enter your cash-out multiplier (or 0 to risk it all): "))
    if cash_out_multiplier > crash_multiplier or cash_out_multiplier <= 0:
        print("Oops! The game crashed before you could cash out.")
        self.balance -= bet_amount
    else:
        winnings = bet_amount * cash_out_multiplier
        self.balance += winnings - bet_amount
        print(f"You cashed out successfully and won: ${winnings - bet_amount:.2f}")
    
    print(f"New Balance: ${self.balance:.2f}")
    return crash_multiplier

def main():
print("Welcome to the Crash Game Emulator! 🎮")
initial_balance = float(input("Enter your initial balance: "))
emulator = CrashGameEmulator(initial_balance)

while True:
    print(f"\nCurrent Balance: ${emulator.balance:.2f}")
    bet = float(input("Enter your bet amount (or 0 to quit): "))
    if bet == 0:
        print("Thanks for playing! Goodbye!")
        break
    emulator.play_round(bet)

if name == "main":
main()

@tianyizheng02 tianyizheng02 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants