import random
# Define the available Pokémon and their attributes
pokemon_pool = {
    "Pikachu": {"health": 100, "attacks": {"Light Bolt": 25, "Super Smash": 50}},
    "Ash Greninja": {"health": 100, "attacks": {"Stealth": 25, "Ultra Spear Attack": 50}},
    "Mewtwo": {"health": 100, "attacks": {"Punch": 25, "Hypnosis": 50}},
    "Charizard": {"health": 100, "attacks": {"Fire Breath": 25, "Ultra Fire Attack": 50}},
}
# Define Pokémon images
pokemon_images = {
    "Pikachu": "Pikachu.png",
    "Ash Greninja": "Ash_Greninja.png",
    "Mewtwo": "Mewtwo.png",
    "Charizard": "Charizard.png",
}
# Define command descriptions
command_descriptions = {
    "1": "Attack: Launch a basic attack with your Pokémon.",
    "2": "Special Move: Use a special move with a chance of higher damage.",
    "3": "Run Away: Flee from the battle.",
}
# Function to perform an attack
def perform_attack(attacker, defender):
    attack_name, damage = random.choice(list(attacker["attacks"].items()))
    defender["health"] -= damage
    return f"{attacker_name} used {attack_name}! {defender_name} lost {damage} health."
# Function to display health bars
def display_health():
    print(f"{attacker_name}'s Health: {'*' * attacker['health']} ({attacker['health']}/100)")
    print(f"{defender_name}'s Health: {'*' * defender['health']} ({defender['health']}/100)")
# Function to run away from a battle
def run_away():
    print(f"{attacker_name} ran away from the battle.")
    exit()
# Player selection
print("Welcome to the Pokémon Battle!")
player1_name = input("Player 1, choose your Pokémon (Pikachu, Ash Greninja, Mewtwo, Charizard): ").strip()
while player1_name not in pokemon_pool:
    player1_name = input("Invalid choice. Choose your Pokémon from the available options: ").strip()
player2_name = input("Player 2, choose your Pokémon (Pikachu, Ash Greninja, Mewtwo, Charizard): ").strip()
while player2_name not in pokemon_pool or player2_name == player1_name:
    player2_name = input("Invalid choice. Choose your Pokémon from the available options: ").strip()
# Initialize players
attacker_name, attacker = (player1_name, pokemon_pool[player1_name]) if random.choice([True, False]) else (player2_name, pokemon_pool[player2_name])
defender_name, defender = (player1_name, pokemon_pool[player1_name]) if attacker_name != player1_name else (player2_name, pokemon_pool[player2_name])
# Display Pokémon images
print(f"\n{attacker_name}'s {attacker_name} vs. {defender_name}'s {defender_name}")
print(f"Pokemon images: {pokemon_images[attacker_name]} vs. {pokemon_images[defender_name]}\n")
# Main game loop
while attacker["health"] > 0 and defender["health"] > 0:
    display_health()
    print("\nSelect your move:")
    for key, description in command_descriptions.items():
        print(f"{key}. {description}")
    choice = input("Enter your choice: ")
    if choice == "1":
        print(perform_attack(attacker, defender))
    elif choice == "2":
        if random.choice([True, False]):
            print(perform_attack(attacker, defender))
        else:
            print(perform_attack(defender, attacker))
    elif choice == "3":
        run_away()
# Determine the winner
print("\nBattle Result:")
if attacker["health"] <= 0:
    print(f"{defender_name} wins!")
else:
    print(f"{attacker_name} wins!")
play_again = input("Play again? (yes/no): ").strip().lower()
if play_again == "no":
    exit()
# Reset Pokémon's health for a new battle
attacker["health"] = 100
defender["health"] = 100
# Switch roles for the new battle
attacker_name, defender_name = defender_name, attacker_name
attacker, defender = defender, attacker
print("\nNew Battle Begins!")
Welcome to the Pokémon Battle!

Pikachu's Pikachu vs. Mewtwo's Mewtwo
Pokemon images: Pikachu.png vs. Mewtwo.png

Pikachu's Health: **************************************************************************************************** (100/100)
Mewtwo's Health: **************************************************************************************************** (100/100)

Select your move:
1. Attack: Launch a basic attack with your Pokémon.
2. Special Move: Use a special move with a chance of higher damage.
3. Run Away: Flee from the battle.
Pikachu used Punch! Mewtwo lost 25 health.
Pikachu's Health: *************************************************************************** (75/100)
Mewtwo's Health: **************************************************************************************************** (100/100)

Select your move:
1. Attack: Launch a basic attack with your Pokémon.
2. Special Move: Use a special move with a chance of higher damage.
3. Run Away: Flee from the battle.
Pikachu used Light Bolt! Mewtwo lost 25 health.
Pikachu's Health: *************************************************************************** (75/100)
Mewtwo's Health: *************************************************************************** (75/100)

Select your move:
1. Attack: Launch a basic attack with your Pokémon.
2. Special Move: Use a special move with a chance of higher damage.
3. Run Away: Flee from the battle.
Pikachu used Light Bolt! Mewtwo lost 25 health.
Pikachu's Health: *************************************************************************** (75/100)
Mewtwo's Health: ************************************************** (50/100)

Select your move:
1. Attack: Launch a basic attack with your Pokémon.
2. Special Move: Use a special move with a chance of higher damage.
3. Run Away: Flee from the battle.
Pikachu used Super Smash! Mewtwo lost 50 health.

Battle Result:
Pikachu wins!