-
Notifications
You must be signed in to change notification settings - Fork 1
/
mine.py
37 lines (26 loc) · 964 Bytes
/
mine.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import random
def mine():
mineable_cryptos = random.randint(0,10)
mine_cryptos = input("How many cryptos You want to mine? ")
if int(mine_cryptos) <= int(mineable_cryptos):
with open("users.txt", "r") as f:
users = f.readlines()
if len(users) > 0:
for u in users:
u = str(u).split(";")
cryptos = int(u[2])
cryptos += int(mine_cryptos)
cryptos_left = int(u[3]) - cryptos
with open("users.txt", "w") as f:
f.write(f"{u[0]};{u[1]};{cryptos};{cryptos_left}")
else:
from simulator import start_game
start_game()
from simulator import start_game
start_game()
else:
print("You can't mine that many cryptos!")
print("")
from simulator import start_game
start_game()
mine()