Simple food and debug bugfix
This commit is contained in:
@@ -107,18 +107,28 @@ def pet(cat: Cat):
|
||||
print(f"You pet {cat.name} a lot. {cat.name} is very happy.")
|
||||
|
||||
|
||||
def feed(cat):
|
||||
if cat.food <= 0:
|
||||
print(f"You don't have any food. {cat.name} is sad.")
|
||||
cat.food -= 1
|
||||
print(f"You feed {cat.name}, {cat.name} is happy")
|
||||
|
||||
|
||||
def house(cat: Cat):
|
||||
print("Welcome to your house!")
|
||||
while True:
|
||||
match ui.select(
|
||||
"Please choose an option",
|
||||
["Check on your cat", "Pet your cat", "Leave your house"],
|
||||
["Check on your cat", "Pet your cat", "Feed your cat", "Leave your house"],
|
||||
):
|
||||
case "Check on your cat":
|
||||
print(
|
||||
f"{cat.name} - a {cat.traits["size"]} {cat.traits["color"]} with {cat.traits["eyes"]} eyes"
|
||||
)
|
||||
print(f"Food: {cat.food}")
|
||||
case "Pet your cat":
|
||||
pet(cat)
|
||||
case "Feed your cat":
|
||||
feed(cat)
|
||||
case "Leave your house":
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user