import random
import time
import threading
coins = 0
cards = {"Honda Civic": 0,
"Jeep Wrangler": 0,
"Hyundai Tuscan": 0,
"Ford Bronco": 0,
"Volkswagen Golf": 0,
"Tesla Model S": 0,
"Ferrari SF90": 0,
"Chevy Silverado": 0,
"Ford Mustang": 0,
"Saturn Sky Roadster": 0,
"Toyota 2000GT": 0,
"Porshe 911": 0,
"Nissan Skyline": 0,
"Supra M4K": 0,
"Tesla Cybertruck": 0
}
cardm = {"Honda Civic": 0.2,
"Jeep Wrangler": 0.5,
"Hyundai Tuscan": 0.5,
"Ford Bronco": 1,
"Volkswagen Golf": 1,
"Tesla Model S": 1.5,
"Ferrari SF90": 10,
"Chevy Silverado": 1,
"Ford Mustang": 2,
"Saturn Sky Roadster": 3,
"Toyota 2000GT": 4,
"Porshe 911": 5,
"Nissan Skyline": 8,
"Supra M4K": 20,
"Tesla Cybertruck": 50
}
print("""Welcome to car cards! For the start, press p to answer multiplication problems to get started,
but soon your cars will make their own money! Answer problems, then open car
packs which have random cars, some better than others. Then you can have those cars make you money!
Also, please note that this game is text based, so all input is in text."""
)
cont = input("Press enter to continue")
def menu():
mchoice = input("You are in the menu, choices: m = Make money, s = Shop, i = Inventory, p = Multiplication: ")
if mchoice == "s":
store()
if mchoice == "i":
inv()
if mchoice == "p":
mult()
if mchoice == "m":
money()
def mult():
global coins
a = random.randint(1, 11)
b = random.randint(1, 11)
sol = (a*b)
answer = input(f"l to leave, what is {a}x{b}?> ")
if answer == "l":
menu()
if int(answer) == sol:
coins += 10
print(f"Correct! +10 coins! Total of {coins}")
mult()
else:
print("Incorrect!")
mult()
def inv():
totalcars = 0
for item, a in cards.items():
print(item, a)
totalcars += a
print("Total cars:", totalcars)
print(coins, "coins")
menu()
def store():
global coins
global cards
print("What car pack would you like to open")
ppack = input("Common = c, Uncommon, 0 = leave: ")
if ppack == "c":
cmany = int(input("How many would you like 30 coins each, 0 to leave: "))
if cmany == "0":
menu()
#if coins < cmany*30:
#print("You dont have enough coins!")
#menu()
checkc(30, cmany)
cA = 0
while cA != cmany:
coins -= 30
cChance = random.randint(1, 100)
if cChance in range(1, 41):
gcar("Honda Civic")
elif cChance in range(41, 76):
gcar("Jeep Wrangler")
elif cChance in range(76, 91):
gcar("Ford Bronco")
elif cChance in range(91, 100):
gcar("Tesla Model S")
elif cChance == 100:
gcar("Ferrari SF90")
cA += 1
print(f"You spent {cmany*30} coins and now have {coins} left")
menu()
if ppack == "u":
umany = int(input("How many would you like, 100 each, 0 to leave: "))
if umany == "0":
menu()
checkc(100, umany)
uA = 0
while uA != umany:
coins -= 100
uChance = random.randint(1, 1000)
if uChance in range(1, 351):
gcar("Chevy Silverado")
elif uChance in range(351, 601):
gcar("Ford Mustang")
elif uChance in range(601, 801):
gcar("Saturn Sky Roadster")
elif uChance in range(801, 901):
gcar("Toyota 2000GT")
elif uChance in range(901, 956):
gcar("Porshe 911")
elif uChance in range(956, 986):
gcar("Nissan Skyline")
elif uChance in range(986, 996):
gcar("Supra M4K")
elif uChance in range(996, 1001):
gcar("Tesla Cybertruck")
uA += 1
print("You spent", umany*100, "coins, and now have", coins, "coins left.")
menu()
def checkc(price, amount):
if coins < price*amount:
print("You dont have enough coins!")
menu()
def gcar(carname):
global cards
cards[carname] = cards.get(carname) + 1
print(f"You got a {carname}!")
def money():
global coins
global car1
global car2
global car3
global flag
global counter
car1 = input("l to leave, What is the first car you wanna have make money for you: ")
if car1 == "l":
menu()
car2 = input("r to do the same car as before, Second car: ")
if car2 == "r":
car2 = car1
car3 = input("r to do the same car as before, Third car: ")
if car3 == "r":
car3 = car2
try:
print(car1, "Is making you", cardm[car1], "coins per sec")
print(car2, "Is making you", cardm[car2], "coins per sec")
print(car3, "Is making you", cardm[car3], "coins per sec")
time.sleep(2)
except:
print("Car not found!")
menu()
if cards[car1] or cards[car2] or cards[car3] > 0:
counter = 0
flag = True
coinscount = coins
thread = threading.Thread(target=moneymake)
thread.daemon = True
thread.start()
stop1 = input()
flag = False
print("You made money for", counter, "seconds, and earned", coins-coinscount, "coins!")
time.sleep(2)
menu()
else:
print("You do not own one of those cars!")
menu()
def moneymake():
global coins
global counter
while flag:
print(car1, "+", cardm[car1], "coins")
coins += cardm[car1]
print(car2, "+", cardm[car2], "coins")
coins += cardm[car2]
print(car3, "+", cardm[car3], "coins")
coins += cardm[car3]
print(f"{counter} seconds elapsed, press enter to stop!")
time.sleep(1)
counter += 1
menu()