Skip to content
TheChatArchiveThe Chat Archive
chatgpt-4o-latest-20250326· OpenAIHugging Face LMArena Human Preference 140K

Make a space combat game where you can pick between different spaceships and fight a bot

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-sonnet-4-20250514’s answer.
  1. User

    Make a space combat game where you can pick between different spaceships and fight a bot

  2. Assistant

    Sure! Here's a simple text-based space combat game made in Python. In this game, you can pick from different spaceships, each with different stats. You'll fight a bot-controlled spaceship in a turn-based combat style.


    🚀 Space Combat Game (Text-Based)

    Features:

    • Choose from different spaceship classes.
    • Fight a bot with randomly chosen stats.
    • Turn-based combat.
    • Basic hit and health mechanics.

    ✅ To Run This Game:

    Copy and paste the code below into a Python file, for example: space_combat.py, and run it using Python 3.


    import random
    import time
    
    # Define spaceship classes
    spaceships = {
        'Fighter': {'HP': 100, 'Attack': 20, 'Defense': 10, 'Speed': 15},
        'Bomber': {'HP': 120, 'Attack': 30, 'Defense': 5, 'Speed': 8},
        'Interceptor': {'HP': 80, 'Attack': 15, 'Defense': 8, 'Speed': 20}
    }
    
    def choose_spaceship():
        print("Choose your spaceship:")
        for name in spaceships:
            stats = spaceships[name]
            print(f"- {name}: HP={stats['HP']} Attack={stats['Attack']} Defense={stats['Defense']} Speed={stats['Speed']}")
        while True:
            choice = input("Enter spaceship name: ").title()
            if choice in spaceships:
                return choice, spaceships[choice].copy()
            else:
                print("Invalid choice. Try again.")
    
    def generate_bot_spaceship():
        bot_name = random.choice(list(spaceships.keys()))
        bot_ship = spaceships[bot_name].copy()
        return bot_name, bot_ship
    
    def attack(attacker, defender):
        damage = attacker['Attack'] - defender['Defense']
        damage = max(5, damage + random.randint(-3, 3))  # Add variation and minimum damage
        defender['HP'] -= damage
        print(f"{attacker['name']} attacks for {damage} damage! {defender['name']} has {max(0, defender['HP'])} HP left.\n")
        time.sleep(1)
    
    def battle(player_ship, bot_ship):
        player_ship['name'] = 'Player'
        bot_ship['name'] = 'Bot'
    
        print("\n🚀 Battle Start!")
        print(f"Player Speed: {player_ship['Speed']}, Bot Speed: {bot_ship['Speed']}")
    
        # Determine who goes first
        player_turn = player_ship['Speed'] >= bot_ship['Speed']
    
        while player_ship['HP'] > 0 and bot_ship['HP'] > 0:
            if player_turn:
                input("Your turn! Press Enter to attack...")
                attack(player_ship, bot_ship)
            else:
                print("Bot's turn...")
                time.sleep(1)
                attack(bot_ship, player_ship)
            player_turn = not player_turn  # Alternate turns
    
        # Determine winner
        if player_ship['HP'] > 0:
            print("🎉 You win!")
        else:
            print("💥 You were defeated by the bot.")
    
    def main():
        print("=== SPACE COMBAT GAME ===\n")
        player_name, player_ship = choose_spaceship()
        bot_name, bot_ship = generate_bot_spaceship()
    
        print(f"\nYou chose: {player_name}")
        print(f"The bot chose: {bot_name}")
    
        battle(player_ship, bot_ship)
    
    if __name__ == "__main__":
        main()
    

    ✨ Possible Improvements

    Want to expand it later? You could add:

    • Special abilities for each class.
    • Critical hits or evasion mechanics.
    • Multiple rounds.
    • A GUI version using tkinter or pygame.

    Let me know if you'd like a graphical version, a multiplayer version, or if you want to add more ships and special abilities!

    🛰️🔥

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.