This is it, adventurer — the final battle, and the end of your journey through Go. This capstone weaves together everything you’ve forged along the way: a struct for your combatants, a method with a pointer receiver to land blows, a slice of monsters, and nested loops to see the fight through.
The hero faces a line of monsters. Each must be worn down to 0 HP before moving to the next. (These monsters have Atk: 0, so the hero fights on unscathed — claim your victory.)
Your Quest
Loop over each monster in monsters. For each, have the hero attack it repeatedly in an inner loop until its HP drops to 0 or below, then increment defeated.
Expected output:
Elara defeated 2 monsters!
Hint
An outer for _, m := range monsters with an inner for m.HP > 0 { hero.attack(m) }, then defeated++ after the inner loop.