A fun turn-based battle simulator written in Python, where two randomly generated characters fight until one emerges victorious. Each fighter has unique health, attack, and defense stats — making every battle unpredictable!
- Randomized Character Stats (Health, Attack, Defense)
- Turn-Based Combat System
- Dynamic Damage Calculation (includes variance and defense)
- Round-by-Round Simulation with time delay for readability
- Automatic Winner Announcement
- Two
Characterobjects are created with random attributes. - The program prints their stats before the battle.
- The first attacker is chosen randomly.
- Each character alternately attacks until one’s health drops to
0. - The winner (or draw) is displayed at the end.
Represents a fighter with:
name: Name of the character.health: Random between 80–120.attack: Random between 15–25.defense: Random between 5–15.is_alive: Boolean tracking survival.
Key Methods
take_damage(damage_amount): Applies damage and updates health.attack_target(target): Calculates and applies damage to another character.
Runs the fight simulation between two characters turn by turn until one wins.