old code:
import time,random
data = []
bitCoin = 0
money = 0
mineSpeed = 1
minePower = 1
multiplier = 1
costPower = 5
costSpeed = 10
leftPower = 0
leftSpeed = 0
gems = 0
gemMulti = 1
autoPower = 1
costGemMulti = 15
costAuto = 20
costMulti = 5
autoMine = False
while True: #MAIN LOOP
print("What do you want to do?")
print("1.) Mine")
print("2.) Sell")
print("3.) Upgrade")
print("4.) Gem Upgrade")
print("5.) Rebirth")
#print("6.) Save")
#print("7.) Load")
action = int(input(""))
def mine(): #MINE FUNCTION
global bitCoin,minePower,mineSpeed
print("Mining...")
time.sleep(2/mineSpeed)
bitCoin += multiplier * (minePower / 1000)
print("You now have %s BitCoin." %bitCoin)
def sell(): #SELL FUNCTION
global money,bitCoin
money += bitCoin * random.randint(1000,5000)
round(money,2)
bitCoin = 0
print("You now have $%s." %money)
def upgrade(): #UPGRADE FUNCTION
global costPower,costSpeed,mineSpeed,minePower,money,leftPower,leftSpeed
round(money,2)
print("What do you want to upgrade?")
print("1.) Mining Power - $%s" %costPower)
print("2.) Mining Speed - $%s" %costSpeed)
print("3.) Cancel")
choice = int(input(""))
if choice == 1:
if money >= costPower:
money = money - costPower
costPower = costPower * 3
minePower = minePower * 2
print("You now have $%s." %money)
else:
leftPower = costPower - money
print("You don't have enough money. You need %s more." %leftPower)
if choice == 2:
if money >= costSpeed:
money = money - costSpeed
costSpeed = costSpeed * 3
mineSpeed = mineSpeed * 2
print("You now have $%s." %money)
else:
leftSpeed = costSpeed - money
print("You don't have enough money. You need %s more." %leftSpeed)
def rebirth(): #REBIRTH FUNCTION
global money,mineSpeed,minePower,costSpeed,costPower,bitCoin
if money >= costRebirth:
money = 0
mineSpeed = 1
minePower = 1
bitCoin = 0
costSpeed = 10
costPower = 5
if bitCoin >= 1:
gems = round(bitCoin)
gems = gems * gemMulti
print("You rebirthed! You now have %s gems." %gems)
def gemUpgrade():
global gems,costAuto,costMulti,costGemMulti,multiplier,autoPower,autoMine,gemMulti
print("What do you want to upgrade?")
print("1.) Auto Mine - G%s" %costAuto)
print("2.) BitCoin Multiplier - G%s" %costMulti)
print("3.) Gem Multiplier - G%s" %costGemMulti)
print("4.) Cancel")
choice = int(input(""))
if choice == 1:
autoPower = autoPower * 2
autoMine = True
elif choice == 2:
multiplier = multiplier * 2
elif choice == 3:
gemMulti = gemMulti * 2
while autoMine == True:
bitCoin += autoPower
time.sleep(1)
#def save():
#data.append(money)
#data.append(mineSpeed)
#data.append(minePower)
#data.append(multiplier)
#data.append(costPower)
#data.append(costSpeed)
#data.append(costSpeed)
#data.append(leftPower)
#data.append(leftSpeed)
#data.append(gems)
#data.append(gemMulti)
#data.append(autoPower)
#data.append(costGemMulti)
#data.append(costAuto)
#data.append(costMulti)
#data.append(autoMine)
#print(data)
#def load():
#global bitCoin,money,mineSpeed,minePower,multipliercostPower,costSpeed,leftPower,leftSpeed,gems,gemMulti,autoPower,costGemMulti,costMulti,autoMine
#load = input("Paste Data Here -> ")
#data = load
#bitCoin = data[0]
#money = data[1]
#mineSpeed = [2]
#minePower = [3]
#multiplier = [4]
#costPower = [5]
#costSpeed = [6]
#leftPower = [7]
#leftSpeed = [8]
#gems = [9]
#gemMulti = [10]
#autoPower = [11]
#costGemMulti = [12]
#costMulti = [13]
#autoMine = [14]
if action == 1:
mine()
if action == 2:
sell()
if action == 3:
upgrade()
if action == 4:
gemUpgrade()
if action == 5:
rebirth()
if action == 6:
save()
if action == 7:
load()
some stuff here aint finished. So save() and load() don’t work in the game yet
My code:
#imports
import time,random
import sys
from time import sleep
from colorama import Fore as F
from colorama import Style as S
from os import system as syst
from replit import db
bright = S.BRIGHT
normal = S.NORMAL
blue = F.BLUE
white = F.WHITE
green = F.LIGHTGREEN_EX
red = F.RED
purple = F.LIGHTMAGENTA_EX
light_blue = F.LIGHTBLUE_EX
#others
p = print
#main def(s)
def clear():
syst('clear');
def enter_to_continue():
p(f'{S.BRIGHT}|{F.BLUE}Enter{F.WHITE}|To Continue{S.NORMAL}');input();
def printtxt(words):
for i in (F.WHITE + words):
sys.stdout.write(i)
sys.stdout.flush()
sleep(.05)
#intro
try:
print(db['INTRO_ONLY_ONCE']);clear()
except:
printtxt(f'{S.BRIGHT}Welcome to {F.BLUE}Bitcoin Miner{F.WHITE}! In this game, you can mine bitcoin to earn {F.LIGHTGREEN_EX}Cash{F.WHITE}! With your {F.LIGHTGREEN_EX}Cash{F.WHITE}, You can use the coins to buy mining power and mining speed which will {F.BLUE}Increase{F.WHITE} Your bitcoin yield!{S.NORMAL}')
print('')
enter_to_continue()
clear()
printtxt('I hope you will enjoy the game, thank you for your time')
print('')
enter_to_continue()
clear()
printtxt('Special thanks to <insert whoever you want in here lolz>')
print('')
enter_to_continue()
clear()
db['INTRO_ONLY_ONCE'] = None
#code
try:
print(db['bitcoin']);clear()
except:
db['bitcoin'] = 0
db['money'] = 0
db['minespeed'] = 1
db['minepower'] = 1
db['multiplier'] = 1
db['costpower'] = 5
db['costspeed'] = 10
db['leftpower'] = 0
db['leftSpeed'] = 0
db['gems'] = 0
db['gemmulti'] = 1
db['autopower'] = 1
db['costgemmulti'] = 15
db['costauto'] = 20
db['costmulti'] = 5
db['automine'] = False
db['costrebirth'] = 100
db['rebirths'] = 0
bitCoin = db['bitcoin']
money = db['money']
mineSpeed = db['minespeed']
minePower =db['minepower']
multiplier = db['multiplier']
costPower = db['costpower']
costSpeed = db['costspeed']
leftPower = db['leftpower']
leftSpeed = db['leftSpeed']
gems = db['gems']
gemMulti = db['gemmulti']
autoPower = db['autopower']
costGemMulti = db['costgemmulti']
costAuto = db['costauto']
costMulti = db['costmulti']
autoMine = db['automine']
costRebirth = db['costrebirth']
rebirths = db['rebirths']
def save():
db['bitcoin'] = bitCoin
db['money'] = money
db['minespeed'] = mineSpeed
db['minepower'] = minePower
db['multiplier'] = multiplier
db['costpower'] = costPower
db['costspeed'] = costSpeed
db['leftpower'] = leftPower
db['leftSpeed'] = leftSpeed
db['gems'] = gems
db['gemmulti'] = gemMulti
db['autopower'] = autoPower
db['costgemmulti'] = costGemMulti
db['costauto'] = costAuto
db['costmulti'] = costMulti
db['automine '] = autoMine
db['costrebirth'] = costRebirth
db['rebirths'] = rebirths
save()
while True: #MAIN LOOP
try:
print('----------------------------------------------------------------------------------')
print(f'Welcome to {bright}{red}Bitcoin_Miner.exe{white}{normal}')
print(f"{bright}{blue}What do you want to do?{white}")
print(f'You have ${green}{money}{white}')
print(f"[{blue}1{white}] {purple}Mine{white}")
print(f"[{blue}2{white}] {green}Sell{white}")
print(f"[{blue}3{white}] {blue}Upgrade{white}")
print(f"[{blue}4{white}] {blue}Gem Upgrade{white}")
print(f"[{blue}5{white}] {red}Rebirth{white} ( ${green}{money}{white} )")
print(f"{bright}[{blue}6{white}] {light_blue}RESET DATA{white} {red}Not Recommended{white}")
print(f'Note: Game is {green}autosaved{white}{normal}')
print(f'{bright}You have {blue}{rebirths}{white} {red}rebirths{white}!{normal}')
action = int(input("> "))
clear()
save()
def mine(): #MINE FUNCTION
global bitCoin,minePower,mineSpeed
print(f"{bright}{purple}Mining{white}...{normal}")
time.sleep(2/mineSpeed)
bitCoin += multiplier * (minePower / 1000)
print(f"{bright}You now have {blue}%s{white} BitCoin.{normal}" %bitCoin)
enter_to_continue()
clear()
save()
def sell(): #SELL FUNCTION
global money,bitCoin
money += bitCoin * random.randint(1000,5000)
round(money,2)
bitCoin = 0
print(f"{bright}You now have ${green}%s{white}.{normal}" %money)
enter_to_continue()
clear()
save()
def upgrade(): #UPGRADE FUNCTION
global costPower,costSpeed,mineSpeed,minePower,money,leftPower,leftSpeed
round(money,2)
print(f"{bright}What do you want to {blue}upgrade?{white}")
print(f"[{blue}1{white}] {green}Mining Power{white} - $%s" %costPower)
print(f"[{blue}2{white}] {purple}Mining Speed{white} - $%s" %costSpeed)
print(f"[{blue}3{white}] {red}Cancel{white}{normal}")
print(f'{bright}You have ${db["money"]}{normal}')
choice = int(input("> "))
clear()
save()
if choice == 1:
if money >= costPower:
money = money - costPower
costPower = costPower * 3
minePower = minePower * 2
print(f"{bright}You now have ${green}%s{white}.{normal}" %money)
enter_to_continue()
clear()
save()
else:
leftPower = costPower - money
print(f"You don't have enough {bright}{green}money{normal}{white}. You need {red}%s{white} more." %leftPower)
enter_to_continue()
clear()
save()
if choice == 2:
if money >= costSpeed:
money = money - costSpeed
costSpeed = costSpeed * 3
mineSpeed = mineSpeed * 2
print(f"{bright}You now have {green}$%s{white}.{normal}" %money)
enter_to_continue()
clear()
clear()
else:
leftSpeed = costSpeed - money
print(f"You don't have enough {bright}{green}money{normal}{white}. You need %s more." %leftSpeed)
enter_to_continue()
clear()
save()
def rebirth(): #REBIRTH FUNCTION
global money,mineSpeed,minePower,costSpeed,costPower,bitCoin
if money >= costRebirth:
money = 0
mineSpeed = 1
minePower = 1
costSpeed = 10
costPower = 5
if bitCoin >= 1:
gems = round(bitCoin)
gems = gems * gemMulti
print(f"You {bright}{green}rebirthed{white}{normal}! You now have %s gems." %gems)
bitCoin = 0
enter_to_continue()
clear()
save()
else:
printtxt('You do not have enough money to buy a rebirth!')
print('')
enter_to_continue()
clear()
save()
def gemUpgrade():
global gems,costAuto,costMulti,costGemMulti,multiplier,autoPower,autoMine,gemMulti
print(f"{bright}What do you want to {blue}upgrade?{white}")
print(f"[{blue}1{white}] {purple}Auto Mine{white} - G%s" %costAuto)
print(f"[{blue}2{white}] {red}BitCoin Multiplier{white} - G%s" %costMulti)
print(f"[{blue}3{white}] {green}Gem Multiplier{white} - G%s" %costGemMulti)
print(f"[{blue}4{white}] {red}Cancel{white}{normal}")
choice = int(input(""))
clear()
save()
match choice:
case 1:
autoPower = autoPower * 2
autoMine = True
case 2:
multiplier = multiplier * 2
case 3:
gemMulti = gemMulti * 2
while autoMine == True:
bitCoin += autoPower
time.sleep(1)
if action == 1:
mine()
if action == 2:
sell()
if action == 3:
upgrade()
if action == 4:
gemUpgrade()
if action == 5:
rebirth()
if action == 6:
while True:
print(f'{bright}Are you sure you want to {red}Reset{white} your {blue}progress{white}?{normal}')
print(f'{bright}[{blue}1{white}] {green}Yes{white}')
print(f'[{blue}2{white}] {red}No{white}')
reset_confirm = input().lower()
clear()
if reset_confirm == '1':
print('Resetting...')
db['bitcoin'] = 0
db['money'] = 0
db['minespeed'] = 1
db['minepower'] = 1
db['multiplier'] = 1
db['costpower'] = 5
db['costspeed'] = 10
db['leftpower'] = 0
db['leftSpeed'] = 0
db['gems'] = 0
db['gemmulti'] = 1
db['autopower'] = 1
db['costgemmulti'] = 15
db['costauto'] = 20
db['costmulti'] = 5
db['automine'] = False
db['costrebirth'] = 100
del db['INTRO_ONLY_ONCE']
sleep(5)
print('Your progress has been reset, thank you!')
print('Please restart the program!')
save()
exit()
elif reset_confirm == '2':
clear()
break
except:
print('error');clear()
this is the new code
theres autosave and many more features
Tbh this could have been done so much better I did this in 1 hour don’t judge how bad I am i know i am trash at programming
I only fixed rebirth and some other stuff, i didnt fix everything