BitCoin Miner Insperation

I don’t know what to add to my game. Maybe you can help me! Give me some ideas of what I should add to my game, if I like that idea I might follow through and use it to expand my game and I’ll add your name to my game as thanks. Hope you can help!

3 Likes

I like achievements in any game, so my suggestion would be add achievements. It keeps progressing through the game interesting and it pushes the player to play more.

1 Like

Its pretty irritating that when you misclick something (other than a number) then it just errors and stops the program.

So you can check whether user input is valid or not by using something like "str".isdigit()

1 Like
#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}{costRebirth}{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()
  

over here i used replit database to create a database for you. As what I have seen iirc you are planning to open a file to store the stuff which is annoying and databases are here for a reason.
I have completely removed your save and load as when the player/user runs the code or mines/buys anything. It will be saved automatically. Because I am sure atleast someone would forget to save if It does not save automatically.
Here, for the try and except
I tried to print something from the database then clear the screen
If it prints out an error, it means that the user ran the repl the first time and
the except will catch the error and automatically creates a database for them to store
all their data
like @QuantumCodes said, I also added try and except blocks to prevent unnecessary errors that will stop the program and interrupt the user’s progress
If it does not print an error, it will automatically saves the game and the game will start
I also created a small intro for you.
Note: I am not trying to help you complete the code and I do not want anything in return
Just trying to give you a head start
I also put some stuff in the code to make it clean sry if its messy
@SalladShooter
looks amazing with the colors, I also added a ‘reset progress’ option.

Yeah thanks for the heart
https://replit.com/@Idkwhttph/BitCoin-Miner-v2?v=1

2 Likes

6 posts were split to a new topic: How should you import things in Python