From 8099eedfb3f118cbb5bb64dd19445b886df6cbb8 Mon Sep 17 00:00:00 2001 From: Codex Automation Date: Sat, 30 May 2026 20:28:49 -0300 Subject: [PATCH] Implement collect_gold for issue 4 --- game.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/game.py b/game.py index b13902f..a3ddb8b 100644 --- a/game.py +++ b/game.py @@ -23,9 +23,15 @@ def use_oxygen(self): # Oxygen limit: 100; cannot use oxygen if supply is below 10 and print appropriate message pass - def collect_gold(self, amount): - # Collects gold and increment amount with appropriate message - pass + def collect_gold(self, amount): + # Collects gold and increment amount with appropriate message + if amount <= 0: + print("No gold collected.") + return 0 + + self.gold += amount + print(f"You collected {amount} gold. Total gold: {self.gold}") + return amount class Alien: def __init__(self, name, health, attack):