# ============================================================
# HOMEWORK: Pet Simulator - Practice Classes & Readability
# ============================================================
# Complete this after Lesson 5
# Focus on: Clean code, meaningful names, proper class structure
# Remember: You can message me any questions!
# ============================================================


# ============================================================
# PART 1: Read and Understand
# ============================================================
#
# Here's a starter Pet class. Read it carefully and notice:
#   - Meaningful attribute names (hunger, energy, happiness)
#   - Clear method names that describe what they do
#   - Comments explaining the "why" not the "what"
#   - Whitespace separating logical sections
#
# ============================================================

class Pet:
    """A virtual pet that needs care and attention."""

    def __init__(self, name, species):
        # Basic info
        self.name = name
        self.species = species

        # Stats (0-100 scale)
        self.hunger = 50      # Higher = more hungry
        self.energy = 50      # Higher = more energetic
        self.happiness = 50   # Higher = happier

    def status(self):
        """Display the pet's current state."""
        print(f"\n--- {self.name} the {self.species} ---")
        print(f"  Hunger:    {self.hunger}/100")
        print(f"  Energy:    {self.energy}/100")
        print(f"  Happiness: {self.happiness}/100")

    def feed(self):
        """Feed the pet to reduce hunger."""
        if self.hunger <= 0:
            print(f"{self.name} isn't hungry right now!")
            return

        self.hunger -= 30
        self.happiness += 10

        # Keep stats in valid range
        if self.hunger < 0:
            self.hunger = 0
        if self.happiness > 100:
            self.happiness = 100

        print(f"You fed {self.name}. Yum!")


# --- YOUR TASK 1A: Test the Pet class ---
# Uncomment the lines below and run the file

# my_pet = Pet("Buddy", "Dog")
# my_pet.status()
# my_pet.feed()
# my_pet.status()


# --- YOUR TASK 1B: Answer these questions (in your head or as comments) ---
#
# 1. What does Pet("Buddy", "Dog") do? Which method runs?
#
# 2. Why do we check `if self.hunger < 0` after subtracting?
#
# 3. What would happen if we wrote `Pet` instead of `Pet()`?
#




# ============================================================
# PART 2: Add the play() Method
# ============================================================
#
# Your pet needs to play! Add a play() method to the Pet class.
#
# Requirements:
#   - Playing DECREASES energy by 20
#   - Playing INCREASES happiness by 25
#   - Playing INCREASES hunger by 10 (exercise makes you hungry!)
#   - If energy is below 10, print "Too tired to play!" and return
#   - Keep all stats in 0-100 range
#   - Print a message like "You played with {name}!"
#
# ============================================================

# YOUR CODE: Add the play() method inside the Pet class above
# (Hint: Look at feed() for the pattern)


# --- Test your play() method ---
# Uncomment to test:

# my_pet = Pet("Whiskers", "Cat")
# my_pet.status()
# my_pet.play()
# my_pet.status()




# ============================================================
# PART 3: Add the sleep() Method
# ============================================================
#
# Your pet needs rest! Add a sleep() method.
#
# Requirements:
#   - Sleeping INCREASES energy by 40
#   - Sleeping DECREASES happiness by 5 (boring!)
#   - Sleeping INCREASES hunger by 15 (wake up hungry)
#   - If energy is already above 80, print "Not tired!" and return
#   - Keep all stats in 0-100 range
#   - Print a message like "{name} is sleeping... Zzz"
#
# ============================================================

# YOUR CODE: Add the sleep() method inside the Pet class above


# --- Test your sleep() method ---
# Uncomment to test:

# my_pet = Pet("Bubbles", "Fish")
# my_pet.energy = 20  # Make pet tired
# my_pet.status()
# my_pet.sleep()
# my_pet.status()




# ============================================================
# PART 4: Add a time_passes() Method
# ============================================================
#
# In real life, pets get hungry and tired over time.
# Add a method that simulates time passing.
#
# Requirements:
#   - Hunger INCREASES by 10
#   - Energy DECREASES by 10
#   - Happiness DECREASES by 5
#   - Keep all stats in 0-100 range
#   - Print "Time passes..."
#   - BONUS: If hunger > 80, print "{name} is very hungry!"
#   - BONUS: If energy < 20, print "{name} is exhausted!"
#   - BONUS: If happiness < 20, print "{name} is sad..."
#
# ============================================================

# YOUR CODE: Add the time_passes() method inside the Pet class above


# --- Test time_passes() ---
# Uncomment to test:

# my_pet = Pet("Rocky", "Hamster")
# my_pet.status()
# my_pet.time_passes()
# my_pet.time_passes()
# my_pet.time_passes()
# my_pet.status()




# ============================================================
# PART 5: Create a Game Loop
# ============================================================
#
# Now let's make it interactive! Create a simple game loop
# where the user can choose actions.
#
# Requirements:
#   - Ask user for pet name and species at the start
#   - Show a menu: feed, play, sleep, status, quit
#   - After each action (except status/quit), call time_passes()
#   - Use meaningful variable names (not 'x' or 'flag')
#   - Add comments for each section
#   - Handle invalid input gracefully
#
# ============================================================

def play_game():
    """Main game loop for the pet simulator."""

    # --- Setup ---
    print("=== Welcome to Pet Simulator! ===")
    # YOUR CODE: Ask for pet name and species
    # YOUR CODE: Create the pet instance

    # --- Game Loop ---
    is_playing = True

    while is_playing:
        # YOUR CODE: Show menu options
        # YOUR CODE: Get user choice
        # YOUR CODE: Handle each choice (feed, play, sleep, status, quit)
        # YOUR CODE: Call time_passes() after actions
        pass  # Delete this line when you add your code


# Uncomment to play:
# play_game()




# ============================================================
# PART 6: CHALLENGE - Pet Moods (Optional)
# ============================================================
#
# Add a get_mood() method that returns a string based on stats.
#
# Mood logic:
#   - If happiness > 70 and hunger < 30: return "Ecstatic!"
#   - If happiness > 50: return "Happy"
#   - If hunger > 70: return "Hangry"
#   - If energy < 20: return "Sleepy"
#   - If happiness < 30: return "Sad"
#   - Otherwise: return "Content"
#
# Then update status() to display the mood.
#
# ============================================================

# YOUR CODE: Add get_mood() method and update status()




# ============================================================
# PART 7: CHALLENGE - Multiple Pets (Optional)
# ============================================================
#
# Create a PetShop class that manages multiple pets.
#
# Requirements:
#   - __init__ creates an empty list of pets
#   - add_pet(pet) adds a Pet to the list
#   - show_all_pets() displays status of all pets
#   - feed_all() feeds every pet
#   - find_pet(name) returns the pet with that name, or None
#
# This practices: classes containing other objects (composition)
#
# ============================================================

# YOUR CODE: Create the PetShop class


# --- Test PetShop ---
# shop = PetShop()
# shop.add_pet(Pet("Max", "Dog"))
# shop.add_pet(Pet("Luna", "Cat"))
# shop.add_pet(Pet("Nemo", "Fish"))
# shop.show_all_pets()
# shop.feed_all()
# shop.show_all_pets()




# ============================================================
# READABILITY CHECKLIST
# ============================================================
#
# Before submitting, check your code against these principles:
#
# [ ] Meaningful names - Can someone understand what each variable does?
# [ ] Whitespace - Are logical sections separated by blank lines?
# [ ] Comments - Did you explain WHY, not just WHAT?
# [ ] Consistency - Same naming style throughout (snake_case)?
# [ ] Short methods - Does each method do ONE thing?
#
# ============================================================


# ============================================================
# DONE!
# ============================================================
#
# Bring this file to our next lesson - we'll review your code
# and see how clean and readable you made it!
#
# Remember: Working code is good. Clean, readable code is better.
#
# ============================================================
