-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathMinercraft_creation
More file actions
31 lines (25 loc) · 965 Bytes
/
Minercraft_creation
File metadata and controls
31 lines (25 loc) · 965 Bytes
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
import random
blocks = ["stone", "coal", "iron", "diamond"]
inventory = {"stone": 0, "coal": 0, "iron": 0, "diamond": 0}
def mine_block():
return random.choice(blocks)
def build_structure():
print("You are building a structure using your inventory resources.")
# Logic for building the structure using inventory resources can be added here.
def play_game():
while True:
action = input("What would you like to do? Mine or Build? (Type 'quit' to exit) ").lower()
if action == "mine":
mined_block = mine_block()
print(f"You mined: {mined_block}")
inventory[mined_block] += 1
elif action == "build":
build_structure()
elif action == "quit":
print("Thanks for playing!")
break
else:
print("Please enter a valid action (mine, build, quit).")
if __name__ == "__main__":
print("Welcome to Minecraft Lite!")
play_game()